home *** CD-ROM | disk | FTP | other *** search
/ ASME's Mechanical Engine…ing Toolkit 1997 December / ASME's Mechanical Engineering Toolkit 1997 December.iso / edu_comp / limems40.lzh / LIMEMS40.DOC
Text File  |  1987-10-12  |  410KB  |  12,452 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                            LOTUS(R)/INTEL(R)/MICROSOFT(R)
  13.  
  14.                           EXPANDED MEMORY SPECIFICATION[1]
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.                                      Version 4.0
  28.                                      300275-004
  29.                                     August, 1987
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.           Copyright (C) 1987
  43.  
  44.           Lotus Development Corporation
  45.           55 Cambridge Parkway
  46.           Cambridge, MA  02142
  47.  
  48.           Intel Corporation
  49.           5200 NE Elam Young Parkway
  50.           Hillsboro, OR  97124
  51.  
  52.           Microsoft Corporation
  53.           16011 NE 35th Way
  54.           Box 97017
  55.           Redmond, WA  98073
  56.  
  57.  
  58.                [1] Transcribed into machine-readable form by Dick Flanagan,
  59.           Ben Lomond, California.  This transcription is released into the
  60.           public domain without warranty or assumption of liability.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.                This specification was jointly developed by Lotus Develop-
  67.                ment Corporation, Intel Corporation, and Microsoft Corpora-
  68.                tion.  Although it has been released into the public domain
  69.                and is not confidential or proprietary, the specification is
  70.                still the copyright and property of Lotus Development
  71.                Corporation, Intel Corporation, and Microsoft Corporation.
  72.  
  73.  
  74.           DISCLAIMER OF WARRANTY
  75.  
  76.                LOTUS DEVELOPMENT CORPORATION, INTEL CORPORATION, AND MICRO-
  77.                SOFT CORPORATION EXCLUDE ANY AND ALL IMPLIED WARRANTIES,
  78.                INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  79.                PARTICULAR PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT
  80.                MAKE ANY WARRANTY OF REPRESENTATION, EITHER EXPRESS OR
  81.                IMPLIED, WITH RESPECT TO THIS SPECIFICATION, ITS QUALITY,
  82.                PERFORMANCE, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR
  83.                PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT SHALL HAVE
  84.                ANY LIABILITY FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  85.                DAMAGES ARISING OUT OF OR RESULTING FROM THE USE OR MODIF-
  86.                ICATION OF THIS SPECIFICATION.
  87.  
  88.  
  89.  
  90.           This specification uses the following trademarks:
  91.  
  92.           Intel is a trademark of Intel Corporation
  93.           Lotus is a trademark of Lotus Development Corporation
  94.           Microsoft is a trademark of Microsoft Corporation
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.                                                                          ii
  120.  
  121.  
  122.  
  123.  
  124.  
  125.           CONTENTS
  126.  
  127.  
  128.  
  129.           Chapter 1
  130.           INTRODUCTION
  131.             What is Expanded Memory? . . . . . . . . . . . . . . . . .    1
  132.             How Expanded Memory Works  . . . . . . . . . . . . . . . .    1
  133.  
  134.           Chapter 2
  135.           WRITING PROGRAMS THAT USE EXPANDED MEMORY
  136.             What Every Program Must Do . . . . . . . . . . . . . . . .    4
  137.             Advanced Programming . . . . . . . . . . . . . . . . . . .    5
  138.               Saving the state of mapping hardware . . . . . . . . . .    6
  139.               Retrieving Handle and Page Counts  . . . . . . . . . . .    6
  140.               Mapping and Unmapping Multiple Pages . . . . . . . . . .    6
  141.               Reallocating Pages . . . . . . . . . . . . . . . . . . .    6
  142.               Using Handles and Assigning Names to Handles . . . . . .    6
  143.               Using Handle Attributes  . . . . . . . . . . . . . . . .    7
  144.               Altering Page Maps and Jumping/Calling . . . . . . . . .    7
  145.               Moving or Exchanging Memory Regions  . . . . . . . . . .    7
  146.               Getting the Amount of Mappable Memory  . . . . . . . . .    8
  147.               Operating System Functions . . . . . . . . . . . . . . .    8
  148.             Programming Guidelines . . . . . . . . . . . . . . . . . .   12
  149.             Examples . . . . . . . . . . . . . . . . . . . . . . . . .   14
  150.               Example 1  . . . . . . . . . . . . . . . . . . . . . . .   14
  151.               Example 2  . . . . . . . . . . . . . . . . . . . . . . .   19
  152.               Example 3  . . . . . . . . . . . . . . . . . . . . . . .   23
  153.               Example 4  . . . . . . . . . . . . . . . . . . . . . . .   25
  154.  
  155.           Chapter 3
  156.           EMM FUNCTIONS
  157.             Function 1. Get Status . . . . . . . . . . . . . . . . . .   30
  158.             Function 2. Get Page Frame Address . . . . . . . . . . . .   31
  159.             Function 3. Get Unallocated Page Count . . . . . . . . . .   33
  160.             Function 4. Allocate Pages . . . . . . . . . . . . . . . .   35
  161.             Function 5. Map/Unmap Handle Pages . . . . . . . . . . . .   39
  162.             Function 6. Deallocate Pages . . . . . . . . . . . . . . .   42
  163.             Function 7. Get Version  . . . . . . . . . . . . . . . . .   44
  164.             Function 8. Save Page Map  . . . . . . . . . . . . . . . .   46
  165.             Function 9. Restore Page Map . . . . . . . . . . . . . . .   48
  166.             Function 10. Reserved  . . . . . . . . . . . . . . . . . .   50
  167.             Function 11. Reserved  . . . . . . . . . . . . . . . . . .   51
  168.             Function 12. Get Handle Count  . . . . . . . . . . . . . .   52
  169.             Function 13. Get Handle Pages  . . . . . . . . . . . . . .   54
  170.             Function 14. Get All Handle Pages  . . . . . . . . . . . .   56
  171.             Function 15. Get/Set Page Map  . . . . . . . . . . . . . .   58
  172.               Get Page Map subfunction . . . . . . . . . . . . . . . .   58
  173.               Set Page Map subfunction . . . . . . . . . . . . . . . .   60
  174.               Get & Set Page Map subfunction . . . . . . . . . . . . .   62
  175.               Get Size of Page Map Save Array subfunction  . . . . . .   64
  176.  
  177.  
  178.                                                                         iii
  179.  
  180.  
  181.  
  182.  
  183.  
  184.             Function 16. Get/Set Partial Page Map  . . . . . . . . . .   66
  185.               Get Partial Page Map subfunction . . . . . . . . . . . .   66
  186.               Set Partial Page Map subfunction . . . . . . . . . . . .   69
  187.               Get Size of Partial Page Map Save Array subfunction  . .   71
  188.             Function 17. Map/Unmap Multiple Handle Pages . . . . . . .   73
  189.               Mapping Multiple Pages . . . . . . . . . . . . . . . . .   73
  190.               Unmapping Multiple Pages . . . . . . . . . . . . . . . .   73
  191.               Mapping and Unmapping Multiple Pages Simultaneously  . .   73
  192.               Alternate Mapping and Unmapping Methods  . . . . . . . .   74
  193.               Logical Page/Physical Page Method  . . . . . . . . . . .   75
  194.               Logical Page/Segment Address Method  . . . . . . . . . .   78
  195.             Function 18. Reallocate Pages  . . . . . . . . . . . . . .   81
  196.             Function 19. Get/Set Handle Attribute  . . . . . . . . . .   84
  197.               Design Considerations  . . . . . . . . . . . . . . . . .   84
  198.               Get Handle Attribute subfunction . . . . . . . . . . . .   85
  199.               Set Handle Attribute subfunction . . . . . . . . . . . .   87
  200.               Get Attribute Capability subfunction . . . . . . . . . .   89
  201.             Function 20. Get/Set Handle Name . . . . . . . . . . . . .   91
  202.               Get Handle Name subfunction  . . . . . . . . . . . . . .   91
  203.               Set Handle Name subfunction  . . . . . . . . . . . . . .   93
  204.             Function 21. Get Handle Directory  . . . . . . . . . . . .   95
  205.               Get Handle Directory subfunction . . . . . . . . . . . .   95
  206.               Search For Named Handle subfunction  . . . . . . . . . .   98
  207.               Get Total Handles subfunction  . . . . . . . . . . . . .  100
  208.             Function 22. Alter Page Map & Jump . . . . . . . . . . . .  102
  209.             Function 23. Alter Page Map & Call . . . . . . . . . . . .  106
  210.               Alter Page Map & Call subfunction  . . . . . . . . . . .  106
  211.               Get Page Map Stack Space Size subfunction  . . . . . . .  111
  212.             Function 24. Move/Exchange Memory Region . . . . . . . . .  113
  213.               Move Memory Region subfunction . . . . . . . . . . . . .  113
  214.               Exchange Memory Region subfunction . . . . . . . . . . .  119
  215.             Function 25. Get Mappable Physical Address Array . . . . .  126
  216.               Get Mappable Physical Address Array subfunction  . . . .  126
  217.               Get Mappable Physical Address Array Entries subfunction   130
  218.             Function 26. Get Expanded Memory Hardware Information  . .  132
  219.               Get Hardware Configuration Array subfunction . . . . . .  132
  220.               Get Unallocated Raw Page Count subfunction . . . . . . .  136
  221.             Function 27. Allocate Raw Pages  . . . . . . . . . . . . .  138
  222.             Function 28. Alternate Map Register Set  . . . . . . . . .  141
  223.               Design Considerations  . . . . . . . . . . . . . . . . .  141
  224.               System DMA Capabilities & Expanded Memory Support of DMA  141
  225.               Expanded Memory Support of DMA Register Sets . . . . . .  141
  226.               Get Alternate Map Register Set subfunction . . . . . . .  143
  227.               Set Alternate Map Register Set subfunction . . . . . . .  146
  228.               Get Alternate Map Save Array Size subfunction  . . . . .  150
  229.               Allocate Alternate Map Register Set subfunction  . . . .  152
  230.               Deallocate Alternate Map Register Set subfunction  . . .  155
  231.               Allocate DMA Register Set subfunction  . . . . . . . . .  157
  232.               Enable DMA on Alternate Map Register Set subfunction . .  159
  233.               Disable DMA on Alternate Map Register Set subfunction  .  162
  234.               Deallocate DMA Register Set subfunction  . . . . . . . .  164
  235.             Function 29. Prepare Expanded Memory Hardware For Warm Boot 166
  236.  
  237.                                                                          iv
  238.  
  239.  
  240.  
  241.  
  242.  
  243.             Function 30. Enable/Disable OS/E Function Set Functions  .  168
  244.               Enable OS/E Function Set subfunction . . . . . . . . . .  168
  245.               Disable OS/E Function Set subfunction  . . . . . . . . .  171
  246.               Return Access Key subfunction  . . . . . . . . . . . . .  174
  247.  
  248.           Appendix A
  249.           FUNCTION AND STATUS CODE CROSS REFERENCE TABLES
  250.             Function and Status Code Cross Reference . . . . . . . . .  176
  251.             Status and Function Code Cross Reference . . . . . . . . .  180
  252.  
  253.           Appendix B
  254.           TESTING FOR THE PRESENCE OF THE EXPANDED MEMORY MANAGER
  255.             Which method should your program use?  . . . . . . . . . .  187
  256.             The "open handle" technique  . . . . . . . . . . . . . . .  187
  257.             The "get interrupt vector" technique . . . . . . . . . . .  192
  258.  
  259.           Appendix C
  260.           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES
  261.             The amount of expanded memory supported  . . . . . . . . .  194
  262.             The number of handles supported  . . . . . . . . . . . . .  194
  263.             Handle Numbering . . . . . . . . . . . . . . . . . . . . .  194
  264.             New handle type:  Handles versus Raw Handles . . . . . . .  194
  265.             The system Raw Handle (Raw Handle = 0000)  . . . . . . . .  195
  266.             Terminate and Stay Resident (TSR) Program Cooperation  . .  196
  267.             Accelerator Cards  . . . . . . . . . . . . . . . . . . . .  196
  268.  
  269.           Appendix D
  270.           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28
  271.             Examples . . . . . . . . . . . . . . . . . . . . . . . . .  197
  272.               Example 1  . . . . . . . . . . . . . . . . . . . . . . .  197
  273.               Example 2  . . . . . . . . . . . . . . . . . . . . . . .  198
  274.               Example 3  . . . . . . . . . . . . . . . . . . . . . . .  199
  275.  
  276.           GLOSSARY
  277.  
  278.           INDEX
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.                                                                           v
  297.  
  298.  
  299.  
  300.  
  301.  
  302.           Chapter 1
  303.           INTRODUCTION
  304.  
  305.  
  306.                Because even the maximum amount (640K bytes) of conventional
  307.                memory isn't always enough for large application programs,
  308.                Lotus Development Corporation, Intel Corporation, and Micro-
  309.                soft Corporation created the Lotus/Intel/Microsoft (LIM)
  310.                Expanded Memory Specification.
  311.  
  312.                The LIM Expanded Memory Specification defines the software
  313.                interface between the Expanded Memory Manager (EMM) -- a
  314.                device driver that controls and manages expanded memory --
  315.                and application programs that use expanded memory.
  316.  
  317.  
  318.           What is Expanded Memory?
  319.  
  320.                Expanded memory is memory beyond DOS's 640K-byte limit.  The
  321.                LIM specification supports up to 32M bytes of expanded
  322.                memory.  Because the 8086, 8088, and 80286 (in real mode)
  323.                microprocessors can physically address only 1M bytes of
  324.                memory, they access expanded memory through a window in
  325.                their physical address range.  The next section explains how
  326.                this is done.
  327.  
  328.  
  329.           How Expanded Memory Works
  330.  
  331.                Expanded memory is divided into segments called logical
  332.                pages.  These pages are typically 16K bytes of memory.  Your
  333.                computer accesses logical pages through a physical block of
  334.                memory called a page frame.  The page frame contains
  335.                multiple physical pages, pages that the microprocessor can
  336.                address directly.  Physical pages are also typically 16K
  337.                bytes of memory.
  338.  
  339.                This page frame serves as a window into expanded memory. 
  340.                Just as your computer screen is a window into a large
  341.                spreadsheet, so the page frame is a window into expanded
  342.                memory.
  343.  
  344.                A logical page of expanded memory can be mapped into (made
  345.                to appear in) any one of the physical pages in the page
  346.                frame.  Thus, a read or write to the physical page actually
  347.                becomes a read or write to the associated logical page.  One
  348.                logical page can be mapped into the page frame for each
  349.                physical page.
  350.  
  351.                Figure 1-1 shows the relationship among the page frame,
  352.                physical pages, and logical pages.
  353.  
  354.  
  355.           Introduction                                                    1
  356.  
  357.  
  358.  
  359.  
  360.  
  361.                                                        32M +--------------+
  362.                                                           /|              |
  363.                                                            |              |
  364.                                                      /     |              |
  365.                                                            |              |
  366.                                                 /          |              |
  367.                                                            |              |
  368.                                            /               |              |
  369.                                                            |   Expanded   |
  370.                                       /                    |    Memory    |
  371.           1024K +--------------+                           |              |
  372.                 | / / / / / /  | /                         |              |
  373.            960K +--------------+                           |              |
  374.                 |  Page Frame  |                           |              |
  375.                 |              |                           |              |
  376.                 | 12 16K-Byte  |                           |              |
  377.                 |   Physical   |                           |              |
  378.                 |    Pages     |                           |              |
  379.            768K +--------------+                           | Divided into |
  380.                 | / / / / / /  | \                         |   logical    |
  381.            640K +--------------+                           |    pages     |
  382.                 |              |   \                       |              |
  383.                 |              |                           |              |
  384.                 |              |     \                     |              |
  385.                 |              |                           |              |
  386.                 | 24 16K-Byte  |       \                   |              |
  387.                 |   Physical   |                           |              |
  388.                 |    Pages*    |         \                 |              |
  389.                 |              |                           |              |
  390.                 |              |           \               |              |
  391.                 |              |                           |              |
  392.                 |              |             \             |              |
  393.            256K +--------------+                           |              |
  394.                 |              |               \           |              |
  395.                 | / / / / / /  |                           |              |
  396.                 |              |                 \         |              |
  397.                 | / / / / / /  |                           |              |
  398.                 |              |                   \       |              |
  399.                 | / / / / / /  |                           |              |
  400.                 |              |                     \     |              |
  401.               0 +--------------+                           |              |
  402.                                                        \   |              |
  403.                                                            |              |
  404.           *Intended for operating                        \ |              |
  405.            system/environment use only                   0 +--------------+
  406.  
  407.  
  408.  
  409.           Figure 1-1.  Expanded Memory
  410.  
  411.  
  412.  
  413.  
  414.           Introduction                                                    2
  415.  
  416.  
  417.  
  418.  
  419.  
  420.                The page frame is located above 640K bytes.  Normally, only
  421.                video adapters, network cards, and similar devices exist
  422.                between 640K and 1024K.
  423.  
  424.                This specification also defines methods for operating
  425.                systems and environments to access expanded memory through
  426.                physical pages below 640K bytes.  These methods are intended
  427.                for operating system/environment developers only.
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.           Introduction                                                    3
  474.  
  475.  
  476.  
  477.  
  478.  
  479.           Chapter 2
  480.           WRITING PROGRAMS THAT USE EXPANDED MEMORY
  481.  
  482.  
  483.                This chapter describes what every program must do to use
  484.                expanded memory and describes more advanced techniques of
  485.                using expanded memory.
  486.  
  487.                This chapter also lists programming guidelines you should
  488.                follow when writing programs that use expanded memory and
  489.                provides the listings of some example programs.
  490.  
  491.  
  492.           What Every Program Must Do
  493.  
  494.                This section describes the steps every program must take to
  495.                use expanded memory.
  496.  
  497.                In order to use expanded memory, applications must perform
  498.                these steps in the following order:
  499.  
  500.                1.  Determine if EMM is installed.
  501.  
  502.                2.  Determine if enough expanded memory pages exist for your
  503.                    application.  (Function 3)
  504.  
  505.                3.  Allocate expanded memory pages.  (Function 4 or 18)
  506.  
  507.                4.  Get the page frame base address.  (Function 2)
  508.  
  509.                5.  Map in expanded memory pages.  (Function 5 or 17)
  510.  
  511.                6.  Read/write/execute data in expanded memory, just as if
  512.                    it were conventional memory.
  513.  
  514.                7.  Return expanded memory pages to expand memory pool
  515.                    before exiting.  (Function 6 or 18)
  516.  
  517.                Table 2-1 overviews the functions while Chapter 3 describes
  518.                each of these functions in detail.  Example programs at the
  519.                end of this chapter illustrate using expanded memory.
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.           Writing Programs That Use Expanded Memory                       4
  533.  
  534.  
  535.  
  536.  
  537.  
  538.           Table 2-1.  The Basic Functions
  539.           ----------------------------------------------------------------
  540.  
  541.           Function                        Description
  542.  
  543.           ----------------------------------------------------------------
  544.  
  545.              1         The Get Status Function returns a status code
  546.                        indicating whether the memory manager hardware is
  547.                        working correctly.
  548.  
  549.              2         The Get Page Frame Address function returns the
  550.                        address where the 64K-byte page frame is located.
  551.  
  552.              3         The Get Unallocated Page Count function returns the
  553.                        number of unallocated pages (pages available to your
  554.                        program) and the total number of pages in expanded
  555.                        memory.
  556.  
  557.              4         The Allocate Pages function allocates the number of
  558.                        pages requested and assigns a unique EMM handle to
  559.                        these pages.
  560.  
  561.              5         The Map/Unmap Handle Page function maps a logical
  562.                        page to a specific physical page anywhere in the
  563.                        mappable regions of system memory.
  564.  
  565.              6         The Deallocate Pages deallocates the logical pages
  566.                        currently allocated to an EMM handle.
  567.  
  568.              7         The Get Version function returns the version number
  569.                        of the memory manager software.
  570.  
  571.           ----------------------------------------------------------------
  572.  
  573.  
  574.  
  575.           Advanced Programming
  576.  
  577.                In addition to the basic functions, the Lotus/Intel/Micro-
  578.                soft Expanded Memory Specification provides several advanced
  579.                functions which enhance the capabilities of software that
  580.                uses expanded memory.
  581.  
  582.                The following sections describe the advanced programming
  583.                capabilities and list the advanced EMM functions.
  584.  
  585.  
  586.           Note............................................................
  587.                Before using the advanced functions, programs should first
  588.                call Function 7 (Get Version) to determine whether the
  589.                installed version of EMM supports these functions.
  590.  
  591.           Writing Programs That Use Expanded Memory                       5
  592.  
  593.  
  594.  
  595.  
  596.  
  597.           Saving the state of mapping hardware
  598.  
  599.                Some software (such as interrupt service routines, device
  600.                drivers, and resident software) must save the current state
  601.                of the mapping hardware, switch mapping contexts, manipulate
  602.                sections of expanded memory, and restore the original
  603.                context of the memory mapping hardware.  Use Functions 8 and
  604.                9 or 15 and 16 to save the state of the hardware.
  605.  
  606.  
  607.           Retrieving Handle and Page Counts
  608.  
  609.                Some utility programs need to keep track of how expanded
  610.                memory is being used; use Functions 12 through 14 to do
  611.                this.
  612.  
  613.  
  614.           Mapping and Unmapping Multiple Pages
  615.  
  616.                Mapping multiple pages reduces the overhead an application
  617.                must perform during mapping.  Function 17 lets a program map
  618.                (or unmap) multiple pages at one time.
  619.  
  620.                In addition, you can map pages using segment addresses
  621.                instead of physical pages.  For example, if the page frame
  622.                base address is set to D000, you can map to either physical
  623.                page 0 or segment D000.  Function 25 (Get Mappable Physical
  624.                Address Array) returns a cross reference between all
  625.                expanded memory physical pages and their corresponding
  626.                segment values.
  627.  
  628.  
  629.           Reallocating Pages
  630.  
  631.                Reallocating pages (Function 18) lets applications dynami-
  632.                cally allocate expanded memory pages without acquiring
  633.                another handle or obtain a handle without allocating pages. 
  634.                Reallocating pages is an efficient means for applications to
  635.                obtain and release expanded memory pages.
  636.  
  637.  
  638.           Using Handles and Assigning Names to Handles
  639.  
  640.                This specification lets you associate a name with a handle,
  641.                so a family of applications can share information in
  642.                expanded memory.  For example, a software package consisting
  643.                of a word processor, spreadsheet, and print spooler can
  644.                share the same data among the different applications.  The
  645.                print spooler could use a handle name to reference data that
  646.                either the spreadsheet or word processor put in expanded
  647.                memory and could check for data in a particular handle
  648.                name's memory pages.
  649.  
  650.           Writing Programs That Use Expanded Memory                       6
  651.  
  652.  
  653.  
  654.  
  655.  
  656.                Use Function 20 (Set Handle Name subfunction) to assign a
  657.                handle name to an EMM handle or Function 21 (Search for
  658.                Named Handle subfunction) to obtain the EMM handle as-
  659.                sociated with the handle name.  In addition, you can use
  660.                Function 14 (Get Handle Pages) to determine the number of
  661.                expanded memory pages allocated to an EMM handle.
  662.  
  663.  
  664.           Using Handle Attributes
  665.  
  666.                In addition to naming a handle, you can use Function 19 to
  667.                associate an attribute (volatile or non-volatile) with a
  668.                handle name.  A non-volatile attribute enables expanded
  669.                memory pages to preserve their data through a warmboot. 
  670.                With a volatile attribute, the data is not preserved.  The
  671.                default attribute for handles is volatile.
  672.  
  673.                Because using this function depends on the capabilities of
  674.                the expanded memory hardware installed in the system, you
  675.                should use the Get Attribute Capability subfunction before
  676.                attempting to assign an attribute to a handle's pages.
  677.  
  678.  
  679.           Altering Page Maps and Jumping/Calling
  680.  
  681.                You can use Functions 22 (Alter Page Map & Jump) and 23
  682.                (Alter Page Map & Call) to map a new set of values into the
  683.                map registers and transfer program control to a specified
  684.                address within expanded memory.  These functions can be used
  685.                to load and execute code in expanded memory.  An application
  686.                using this feature can significantly reduce the amount of
  687.                conventional memory it requires.  Programs can load needed
  688.                modules into expanded memory at run time and use Functions
  689.                22 and 23 to transfer control to these modules.
  690.  
  691.                Using expanded memory to store code can improve program
  692.                execution in many ways.  For example, sometimes programs
  693.                need to be divided into small overlays because of conven-
  694.                tional memory size limitations.  Overlays targeted for
  695.                expanded memory can be very large because LIM EMS 4.0
  696.                supports up to 32M bytes of expanded memory.  This method of
  697.                loading overlays improves overall system performance by
  698.                conserving conventional memory and eliminating conventional
  699.                memory allocation errors.
  700.  
  701.  
  702.           Moving or Exchanging Memory Regions
  703.  
  704.                Using Function 24 (Move/Exchange Memory Region), you can
  705.                easily move and exchange data between conventional and
  706.                expanded memory.  Function 24 can manipulate up to one
  707.                megabyte of data with one function call.  Although applica-
  708.  
  709.           Writing Programs That Use Expanded Memory                       7
  710.  
  711.  
  712.  
  713.  
  714.  
  715.                tions can perform this operation without this function,
  716.                having the expanded memory manager do it reduces the amount
  717.                of overhead for the application.
  718.  
  719.                In addition, this function checks for overlapping regions
  720.                and performs all the necessary mapping, preserving the
  721.                mapping context from before the exchange/move call.
  722.  
  723.  
  724.           Getting the Amount of Mappable Memory
  725.  
  726.                Function 25 enables applications to determine the total
  727.                amount of mappable memory the hardware/system currently
  728.                supports.  Not all expanded memory boards supply the same
  729.                number of physical pages (map registers).
  730.  
  731.                The Get Mappable Physical Address Array Entries subfunction
  732.                returns the total number of physical pages the expanded
  733.                memory hardware/system is capable of supporting.  The Get
  734.                Mappable Physical Array subfunction returns a cross refer-
  735.                ence between physical page numbers and the actual segment
  736.                address for each of the physical pages.
  737.  
  738.  
  739.           Operating System Functions
  740.  
  741.                In addition to the functions for application programs, this
  742.                specification defines functions for operating systems/en-
  743.                vironments.  These functions can be disabled at any time by
  744.                the operating system/environment, so programs should not
  745.                depend on their presence.  Applications that avoid this
  746.                warning and use these functions run a great risk of being
  747.                incompatible with other programs, including the operating
  748.                system.
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.           Writing Programs That Use Expanded Memory                       8
  769.  
  770.  
  771.  
  772.  
  773.  
  774.           Table 2-2.  The Advanced Functions
  775.           ----------------------------------------------------------------
  776.  
  777.           Function                        Description
  778.  
  779.           ----------------------------------------------------------------
  780.  
  781.              8         The Save Page Map saves the contents of the page
  782.                        mapping registers from all expanded memory boards in
  783.                        an internal save area.
  784.  
  785.              9         The Restore Page Map function restores (from an
  786.                        internal save area) the page mapping register
  787.                        contents on the expanded memory boards for a
  788.                        particular EMM handle.
  789.  
  790.              10        Reserved.
  791.  
  792.              11        Reserved.
  793.  
  794.              12        The Get Handle Count function returns the number of
  795.                        open EMM handles in the system.
  796.  
  797.              13        The Get Handle Pages function returns the number of
  798.                        pages allocated to a specific EMM handle.
  799.  
  800.              14        The Get All Handle Pages function returns an array
  801.                        of the active EMM handles and the number of pages
  802.                        allocated to each one.
  803.  
  804.              15        The Get/Set Page Map subfunction saves or restores
  805.                        the mapping context for all mappable memory regions
  806.                        (conventional and expanded) in a destination array
  807.                        which the application supplies.
  808.  
  809.              16        The Get/Set Partial Page Map subfunction provides a
  810.                        mechanism for saving a partial mapping context for
  811.                        specific mappable memory regions in a system.
  812.  
  813.              17        The Map/Unmap Multiple Handle Pages function can, in
  814.                        a single invocation, map (or unmap) logical pages
  815.                        into as many physical pages as the system supports.
  816.  
  817.              18        The Reallocate Pages function can increase or
  818.                        decrease the amount of expanded memory allocated to
  819.                        a handle.
  820.  
  821.              19        The Get/Set Handle Attribute function allows an
  822.                        application program to determine and set the
  823.                        attribute associated with a handle.
  824.  
  825.  
  826.  
  827.           Writing Programs That Use Expanded Memory                       9
  828.  
  829.  
  830.  
  831.  
  832.  
  833.           Table 2-2.  The Advanced Functions (continued)
  834.           ----------------------------------------------------------------
  835.  
  836.           Function                        Description
  837.  
  838.           ----------------------------------------------------------------
  839.  
  840.              20        The Get/Set Handle Name function gets the eight
  841.                        character name currently assigned to a handle and
  842.                        can assign an eight character name to a handle.
  843.  
  844.              21        The Get Handle Directory function returns informa-
  845.                        tion about active handles and the names assigned to
  846.                        each.
  847.  
  848.              22        The Alter Page Map & Jump function alters the memory
  849.                        mapping context and transfers control to the
  850.                        specified address.
  851.  
  852.              23        The Alter Page Map & Call function alters the speci-
  853.                        fied mapping context and transfers control to the
  854.                        specified address.  A return can then restore the
  855.                        context and return control to the caller.
  856.  
  857.              24        The Move/Exchange Memory Region function copies or
  858.                        exchanges a region of memory from conventional to
  859.                        conventional memory, conventional to expanded
  860.                        memory, expanded to conventional memory, or expanded
  861.                        to expanded memory.
  862.  
  863.              25        The Get Mappable Physical Address Array function
  864.                        returns an array containing the segment address and
  865.                        physical page number for each mappable physical page
  866.                        in a system.
  867.  
  868.              26        The Get Expanded Memory Hardware Information
  869.                        function returns an array containing the hardware
  870.                        capabilities of the expanded memory system.
  871.  
  872.              27        The Allocate Raw Pages function allocates the number
  873.                        of non-standard size pages that the operating system
  874.                        requests and assigns a unique EMM handle to these
  875.                        pages.
  876.  
  877.              28        The Alternate Map Register Set function enables an
  878.                        application to simulate alternate sets of hardware
  879.                        mapping registers.
  880.  
  881.              29        The Prepare Expanded Memory Hardware for Warm Boot
  882.                        function prepares the expanded memory hardware for
  883.                        an "impending" warm boot.
  884.  
  885.  
  886.           Writing Programs That Use Expanded Memory                      10
  887.  
  888.  
  889.  
  890.  
  891.  
  892.           Table 2-2.  The Advanced Functions (continued)
  893.           ----------------------------------------------------------------
  894.  
  895.           Function                        Description
  896.  
  897.           ----------------------------------------------------------------
  898.  
  899.              30        The Enable/Disable OS/E function enables operating
  900.                        systems developers to enable and disable functions
  901.                        designed for operating system use.
  902.  
  903.           ----------------------------------------------------------------
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.           Writing Programs That Use Expanded Memory                      11
  946.  
  947.  
  948.  
  949.  
  950.  
  951.           Programming Guidelines
  952.  
  953.                The following section contains guidelines for programmers
  954.                writing applications that use EMM.
  955.  
  956.                o   Do not put a program's stack in expanded memory.
  957.  
  958.                o   Do not replace interrupt 67h.  This is the interrupt
  959.                    vector the EMM uses.  Replacing interrupt 67h could
  960.                    result in disabling the Expanded Memory Manager.
  961.  
  962.                o   Do not map into conventional memory address space your
  963.                    application doesn't own.  Applications that use the EMM
  964.                    to swap into conventional memory space, must first
  965.                    allocate this space from the operating system.  If the
  966.                    operating system is not aware that a region of memory it
  967.                    manages is in use, it will think it is available.  This
  968.                    could have disastrous results.  EMM should not be used
  969.                    to "allocate" conventional memory.  DOS is the proper
  970.                    manager of conventional memory space.  EMM should only
  971.                    be used to swap data in conventional memory space
  972.                    previously allocated from DOS.
  973.  
  974.                o   Applications that plan on using data aliasing in
  975.                    expanded memory must check for the presence of expanded
  976.                    memory hardware.  Data aliasing occurs when mapping one
  977.                    logical page into two or more mappable segments.  This
  978.                    makes one 16K-byte expanded memory page appear to be in
  979.                    more than one 16K-byte memory address space.  Data
  980.                    aliasing is legal and sometimes useful for applications.
  981.  
  982.                    Software-only expanded memory emulators cannot perform
  983.                    data aliasing.  A simple way to distinguish software
  984.                    emulators from actual expanded memory hardware is to
  985.                    attempt data aliasing and check the results.  For
  986.                    example, map one logical page into four physical pages. 
  987.                    Write to physical page 0.  Read physical pages 1-3 to
  988.                    see if the data is there as well.  If the data appears
  989.                    in all four physical pages, then expanded memory
  990.                    hardware is installed in the system, and data aliasing
  991.                    is supported.
  992.  
  993.                o   Applications should always return expanded memory pages
  994.                    to the expanded memory manager upon termination.  These
  995.                    pages will be made available for other applications.  If
  996.                    unneeded pages are not returned to the expanded memory
  997.                    manager, the system could "run out" of expanded memory
  998.                    pages or expanded memory handles.
  999.  
  1000.                o   Terminate and stay resident programs (TSR's) should
  1001.                    always save the state of the map registers before
  1002.                    changing them.  Since TSR's may interrupt other programs
  1003.  
  1004.           Writing Programs That Use Expanded Memory                      12
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.                    which may be using expanded memory, they must not change
  1011.                    the state of the page mapping registers without first
  1012.                    saving them.  Before exiting, TSR's must restore the
  1013.                    state of the map registers.
  1014.  
  1015.                    The following sections describe the three ways to save
  1016.                    and restore the state of the map registers.
  1017.  
  1018.                    1.  Save Page Map and Restore Page Map (Functions 8 and
  1019.                        9).  This is the simplest of the three methods.  The
  1020.                        EMM saves the map register contents in its own data
  1021.                        structures -- the application does not need to
  1022.                        provide extra storage locations for the mapping
  1023.                        context.  The last mapping context to be saved,
  1024.                        under a particular handle, will be restored when a
  1025.                        call to Restore Page Map is issued with the same
  1026.                        handle.  This method is limited to one mapping
  1027.                        context for each handle and saves the context for
  1028.                        only LIM standard 64K-byte page frames.
  1029.  
  1030.                    2.  Get/Set Page Map (Function 15).  This method
  1031.                        requires the application to allocate space for the
  1032.                        storage array.  The EMM saves the mapping context in
  1033.                        an array whose address is passed to the EMM.  When
  1034.                        restoring the mapping context with this method, an
  1035.                        application passes the address of an array which
  1036.                        contains a previously stored mapping context.
  1037.  
  1038.                        This method is preferable if an application needs to
  1039.                        do more than one save before a restore.  It provides
  1040.                        a mechanism for switching between more than one
  1041.                        mapping context.
  1042.  
  1043.                    3.  Get/Set Partial Page Map (Function 16).  This method
  1044.                        provides a way for saving a partial mapping context. 
  1045.                        It should be used when the application does not need
  1046.                        to save the context of all mappable memory.  This
  1047.                        function also requires that the storage array be
  1048.                        part of the application's data.
  1049.  
  1050.                o   All functions using pointers to data structures must
  1051.                    have those data structures in memory which will not be
  1052.                    mapped out.  Functions 22 and 23 (Alter Map & Call and
  1053.                    Alter Map & Jump) are the only exceptions.
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.           Writing Programs That Use Expanded Memory                      13
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.           Examples
  1070.  
  1071.                This section lists four example programs that demonstrate
  1072.                the use of expanded memory.
  1073.  
  1074.  
  1075.           Example 1
  1076.  
  1077.                This program was written using the Microsoft C compiler
  1078.                Version 3.0.  EMM function calls are made with the int86
  1079.                function found in the dos.h library.  To create an ex-
  1080.                ecutable program use the following compile command line:
  1081.  
  1082.                          msc /Gs /Oat /Ml program,,program;
  1083.  
  1084.           #include <dos.h>
  1085.           #include <stdio.h>
  1086.  
  1087.           #define EMM_INT                 0x67  /* EMM interrupt number */
  1088.           #define GET_PAGE_FRAME          0x41  /* EMM get page frame */
  1089.                                                 /* function number */
  1090.           #define GET_UNALLOC_PAGE_COUNT  0x42  /* EMM get unallocated */
  1091.                                                 /* page count */
  1092.                                                 /* function number */
  1093.           #define ALLOCATE_PAGES          0x43  /* EMM allocate pages */
  1094.                                                 /* function number */
  1095.           #define MAP_PAGES               0x44  /* EMM map pages */
  1096.                                                 /* function number */
  1097.           #define DEALLOCATE_PAGES        0x45  /* EMM deallocate pages */
  1098.                                                 /* function number */
  1099.           #define DEVICE_NAME_LENGTH      8     /* length of a device */
  1100.                                                 /* name string */
  1101.           #define TRUE                    1
  1102.           #define FALSE                   0
  1103.  
  1104.           union REGS input_regs, output_regs;
  1105.           struct SREGS segment_regs;
  1106.           int pf_addr;
  1107.  
  1108.           /*------------------------------------------------------------*/
  1109.           /* Routine to convert a segment:offset pair to a far ptr.     */
  1110.           /*------------------------------------------------------------*/
  1111.           char *build_ptr (segment, offset)
  1112.  
  1113.               unsigned int segment;
  1114.               unsigned int offset;
  1115.           {
  1116.               char *ptr;
  1117.  
  1118.               ptr = (char *)(((unsigned long)segment << 16) + offset);
  1119.               return (ptr);
  1120.           }
  1121.  
  1122.           Writing Programs That Use Expanded Memory                      14
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.           /*------------------------------------------------------------*/
  1129.           /* Function which determines whether EMM device driver        */
  1130.           /* is installed.                                              */
  1131.           /*------------------------------------------------------------*/
  1132.           char emm_installed()
  1133.  
  1134.           {
  1135.               char *EMM_device_name = "EMMXXXX0";
  1136.               char *int_67_device_name_ptr;
  1137.  
  1138.               /*--------------------------------------------------------*/
  1139.               /* AH = DOS get interrupt vector function.                */
  1140.               /*--------------------------------------------------------*/
  1141.               input_regs.h.ah = 0x35;
  1142.  
  1143.               /*--------------------------------------------------------*/
  1144.               /* AL = EMM interrupt vector number.                      */
  1145.               /*--------------------------------------------------------*/
  1146.               input_regs.h.al = EMM_INT;
  1147.               intdosx (&input_regs, &output_regs, &segment_regs);
  1148.  
  1149.               /*--------------------------------------------------------*/
  1150.               /* Upon return ES:0Ah points to location where            */
  1151.               /* device name should be.                                 */
  1152.               /*--------------------------------------------------------*/
  1153.               int_67_device_name_ptr = build_ptr (segment_regs.es, 0x0A);
  1154.  
  1155.               /*--------------------------------------------------------*/
  1156.               /* Compare memory with EMM device name.                   */
  1157.               /*--------------------------------------------------------*/
  1158.               if (memcmp (EMM_device_name, int_67_device_name_ptr,
  1159.                                              DEVICE_NAME_LENGTH) == 0)
  1160.                   return (TRUE);
  1161.               else
  1162.                   return (FALSE);
  1163.           }
  1164.  
  1165.           /*------------------------------------------------------------*/
  1166.           /* Function which determines if there are enough unallocated  */
  1167.           /* expanded memory pages for the application.                 */
  1168.           /*------------------------------------------------------------*/
  1169.           char enough_unallocated_pages (pages_needed)
  1170.  
  1171.               int pages_needed;
  1172.           {
  1173.               input_regs.h.ah = GET_UNALLOCATED_PAGE_COUNT;
  1174.               int86 (EMM_INT, &input_regs, &output_regs);
  1175.               if (output_regs.h.ah != 0 || pages_needed > output_regs.x.dx)
  1176.                   return (FALSE);
  1177.               else
  1178.                   return (TRUE);
  1179.           }
  1180.  
  1181.           Writing Programs That Use Expanded Memory                      15
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.           /*------------------------------------------------------------*/
  1188.           /* Function which allocates expanded memory pages and passes  */
  1189.           /* back to the main EMM handle.                               */
  1190.           /*------------------------------------------------------------*/
  1191.           char allocate_expanded_memory_pages (pages_needed,emm_handle_ptr)
  1192.  
  1193.               int pages_needed;
  1194.               unsigned int *emm_handle_ptr;
  1195.           {
  1196.               input_regs.h.ah = ALLOCATE_PAGES;
  1197.               input_regs.x.bx = pages_needed;
  1198.               int86 (EMM_INT, &input_regs, &output_regs);
  1199.               if (output_regs.h.ah == 0) {
  1200.                   *emm_handle_ptr = output_regs.x.dx;
  1201.                   return (TRUE);
  1202.               }
  1203.               else
  1204.                   return (FALSE);
  1205.           }
  1206.  
  1207.           /*------------------------------------------------------------*/
  1208.           /* Routine to map a logical page to a physical page.          */
  1209.           /*------------------------------------------------------------*/
  1210.           char map_expanded_memory_pages (emm_handle, physical_page,       
  1211.                                                              logical_page)
  1212.               unsigned int emm_handle;
  1213.               int physical_page;
  1214.               int logical_page;
  1215.           {
  1216.               input_regs.h.ah = MAP_PAGES;
  1217.               input_regs.h.al = physical_page;
  1218.               input_regs.x.bx = logical_page;
  1219.               input_regs.x.dx = emm_handle;
  1220.               int86 (EMM_INT, &input_regs, &output_regs);
  1221.               if (output_regs.h.ah == 0)
  1222.                   return (TRUE);
  1223.               else
  1224.                   return (FALSE);
  1225.           }
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.           Writing Programs That Use Expanded Memory                      16
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.           /*------------------------------------------------------------*/
  1247.           /* Routine which gets the page frame base address from EMM.   */
  1248.           /*------------------------------------------------------------*/
  1249.           char get_page_frame_address (pf_ptr)
  1250.  
  1251.               char **pf_ptr;
  1252.           {
  1253.               input_regs.h.ah = GET_PAGE_FRAME;
  1254.               int86 (EMM_INT, &input_regs, &output_regs);
  1255.               if (output_regs.h.ah != 0)
  1256.                   return (FALSE);
  1257.               else
  1258.                  *pf_ptr = build_ptr (output_regs.x.bx, 0);
  1259.               return (TRUE);
  1260.           }
  1261.  
  1262.           /*------------------------------------------------------------*/
  1263.           /* Routine to release all expanded memory pages allocated     */
  1264.           /* by an EMM handle.                                          */
  1265.           /*------------------------------------------------------------*/
  1266.  
  1267.           char deallocate_expanded_memory_pages (emm_handle)
  1268.  
  1269.               unsigned int emm_handle;
  1270.           {
  1271.               input_regs.h.ah = DEALLOCATE_PAGES;
  1272.               input_regs.x.dx = emm_handle;
  1273.               int86 (EMM_INT, &input_regs, &output_regs);
  1274.               if (output_regs.h.ah == 0)
  1275.                   return (TRUE);
  1276.               else
  1277.                   return (FALSE);
  1278.           }
  1279.  
  1280.           main()
  1281.  
  1282.           {
  1283.               unsigned int emm_handle;
  1284.               char *pf_addr;
  1285.               int pages_needed;
  1286.               int physical_page;
  1287.               int logical_page;
  1288.               int index;
  1289.  
  1290.               /*--------------------------------------------------------*/
  1291.               /* Determine if EMM is installed.                         */
  1292.               /*--------------------------------------------------------*/
  1293.               if (!emm_installed())
  1294.                   exit(1);
  1295.  
  1296.  
  1297.  
  1298.  
  1299.           Writing Programs That Use Expanded Memory                      17
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.               /*--------------------------------------------------------*/
  1306.               /* Determine if enough expanded memory pages exist for    */
  1307.               /* application.                                           */
  1308.               /*--------------------------------------------------------*/
  1309.               pages_needed = 1;
  1310.               if (!enough_unallocated_memory_pages (pages_needed))         
  1311.                   exit(1);
  1312.  
  1313.               /*--------------------------------------------------------*/
  1314.               /* Allocate expanded memory pages.                        */
  1315.               /*--------------------------------------------------------*/
  1316.               if (!allocate_expanded_memory_pages (pages_needed,
  1317.                                                              &emm_handle))
  1318.                   exit(1);
  1319.  
  1320.               /*--------------------------------------------------------*/
  1321.               /* Map in the required pages.                             */
  1322.               /*--------------------------------------------------------*/
  1323.               physical_page = 0;
  1324.               logical_page = 0;
  1325.               if (!map_expanded_memory_pages (emm_handle, physical_page,
  1326.                                                             logical_page))
  1327.                   exit(1);
  1328.  
  1329.               /*--------------------------------------------------------*/
  1330.               /* Get expanded memory page frame address.                */
  1331.               /*--------------------------------------------------------*/
  1332.               if (!get_page_frame_address (&pf_addr))
  1333.                   exit(1);
  1334.  
  1335.               /*--------------------------------------------------------*/
  1336.               /* Write to expanded memory.                              */
  1337.               /*--------------------------------------------------------*/
  1338.               for (index = 0; index < 0x3fff; index++)
  1339.                   pf_addr[index] = index;
  1340.  
  1341.               /*--------------------------------------------------------*/
  1342.               /* Return expanded memory pages before exiting.           */
  1343.               /*--------------------------------------------------------*/
  1344.               if (!deallocate_expanded_memory_pages (emm_handle))
  1345.                   exit(1);
  1346.           }
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.           Writing Programs That Use Expanded Memory                      18
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.           Example 2
  1365.  
  1366.                This example, written in Borland's Turbo Pascal, calls the
  1367.                EMM through the built-in intr function.
  1368.  
  1369.  
  1370.           PROGRAM emm_example;
  1371.  
  1372.  
  1373.           CONST
  1374.             EMM_INT                 = $67;   {EMM interrupt number}
  1375.             DOS_int                 = $21;   {DOS interrupt number}
  1376.             GET_PAGE_FRAME          = $41;   {EMM get page frame function
  1377.                                               number}
  1378.             GET_UNALLOC_PAGE_COUNT  = $42;   {EMM get unallocated page
  1379.                                               page count function number}
  1380.  
  1381.             ALLOCATE_PAGES          = $43;   {EMM allocate pages function
  1382.                                               number}
  1383.             MAP_PAGES               = $44;   {EMM map pages function
  1384.                                               number}
  1385.             DEALLOCATE_PAGES        = $45;   {EMM deallocate pages         
  1386.                                               function number}
  1387.  
  1388.             device_name_length      = 8;     {length of a device name
  1389.                                               string}
  1390.  
  1391.             PASSED                  = TRUE;
  1392.             FAILED                  = FALSE;
  1393.  
  1394.  
  1395.           TYPE
  1396.             registers = RECORD
  1397.               CASE INTEGER OF
  1398.                 1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,FLAGS    : INTEGER);
  1399.                 2: (AL,AH,BL,BH,CL,CH,DL,DH             : BYTE);
  1400.               END;
  1401.  
  1402.  
  1403.           VAR
  1404.                         regs:    registers;
  1405.                   emm_handle:    INTEGER;
  1406.                      pf_addr:    INTEGER;
  1407.                 pages_needed:    INTEGER;
  1408.                physical_page:    INTEGER;
  1409.                 logical_page:    INTEGER;
  1410.                       offset:    INTEGER;
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.           Writing Programs That Use Expanded Memory                      19
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.           {Function which determines whether the EMM device driver is 
  1424.           installed.}
  1425.           FUNCTION emm_installed:BOOLEAN;
  1426.             VAR
  1427.                          emm_device_name:    STRING[8];
  1428.                       int_67_device_name:    STRING[8];
  1429.                                    index:    INTEGER;
  1430.                                 position:    INTEGER;
  1431.  
  1432.               BEGIN
  1433.                 {initialize EMM device name string}
  1434.                 emm_device_name := 'EMMXXXX0';
  1435.  
  1436.                 {AH = DOS get interrupt vector function}
  1437.                 regs.AH := $35;
  1438.  
  1439.                 {AL = EMM interrupt vector number}
  1440.                 regs.AL := EMM_INT;
  1441.  
  1442.                 intr(DOS_int, regs);
  1443.                 index := 1;
  1444.  
  1445.                 {move into the buffer the 8 bytes pointed to by ES:0Ah}
  1446.                 FOR position := $00A TO ($00A + 8) DO
  1447.                   BEGIN
  1448.                   int_67_device_name[index] := chr(mem[regs.ES:position]);
  1449.                   index := index + 1;
  1450.                   END;
  1451.  
  1452.                 emm_installed := TRUE;
  1453.                 {compare the string in the buffer to EMM device name}
  1454.                 FOR index := 1 TO device_name_length DO
  1455.                   BEGIN
  1456.                   IF (int_67_device_name[index] <> emm_device_name[index])
  1457.                   THEN emm_installed := FALSE;
  1458.                   END;
  1459.               END;
  1460.  
  1461.  
  1462.           {Function which determines if there are enough unallocated 
  1463.           expanded memory pages for the application}
  1464.           FUNCTION enough_unallocated_pages (pages_needed:INTEGER):BOOLEAN;
  1465.             BEGIN
  1466.               regs.AH := GET_UNALLOCATED_PAGE_COUNT;
  1467.               intr(EMM_INT, regs);
  1468.               IF ((pages_needed <= regs.DX) AND (regs.AH = 0)) THEN
  1469.                 enough_unallocated_pages := TRUE;
  1470.               ELSE
  1471.                 enough_unallocated_pages := FALSE;
  1472.             END;
  1473.  
  1474.  
  1475.  
  1476.           Writing Programs That Use Expanded Memory                      20
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.           {Routine which allocates expanded memory pages and passes back to
  1483.            main the EMM handle.}
  1484.           FUNCTION allocate_expanded_memory_pages (pages_needed:INTEGER;
  1485.                                                VAR handle:INTEGER):BOOLEAN;
  1486.  
  1487.             BEGIN
  1488.               regs.AH := ALLOCATE_PAGES;
  1489.               regs.BX := pages_needed;
  1490.               intr(EMM_INT, regs);
  1491.               allocate_expanded_memory_pages := TRUE;
  1492.               IF (regs.AH = 0) THEN
  1493.                 handle := regs.DX;
  1494.               ELSE
  1495.                 allocate_expanded_memory_pages := FAILED;
  1496.             END;
  1497.  
  1498.  
  1499.           {Routine to map a logical page to a physical page}
  1500.           FUNCTION map_expanded_memory_pages (handle, physical_page,
  1501.                                             logical_page:INTEGER):BOOLEAN;
  1502.  
  1503.             BEGIN
  1504.               regs.AH := MAP_PAGES;
  1505.               regs.BX := logical_page;
  1506.               regs.AL := physical_page;
  1507.               regs.DX := handle;
  1508.               intr(EMM_INT, regs);
  1509.               IF (regs.AH = 0) THEN
  1510.                 map_expanded_memory_pages := PASSED;
  1511.               ELSE
  1512.                 map_expanded_memory_pages := FAILED;
  1513.             END;
  1514.  
  1515.  
  1516.           {Routine which gets the page frame base address from EMM}
  1517.           FUNCTION get_page_frame_base_address (VAR page_frame:INTEGER):
  1518.                                                                  BOOLEAN;
  1519.  
  1520.             BEGIN
  1521.               regs.AH := GET_PAGE_FRAME;
  1522.               intr(EMM_INT, regs);
  1523.               get_page_frame_base_address := PASSED;
  1524.               IF regs.AH = 0 THEN
  1525.                 page_frame := regs.BX;
  1526.               ELSE
  1527.                 get_page_frame_base_address := FAILED;
  1528.             END;
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.           Writing Programs That Use Expanded Memory                      21
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.           {Routine to release all expanded memory pages allocated by an EMM
  1542.            handle.}
  1543.           FUNCTION deallocate_expanded_memory_pages (handle:INTEGER):
  1544.                                                                BOOLEAN;
  1545.  
  1546.             BEGIN
  1547.               regs.AH := DEALLOCATE_PAGES;
  1548.               regs.DX := handle;
  1549.               intr(EMM_INT, regs);
  1550.               IF (regs.AH = 0) THEN
  1551.                 deallocate_expanded_memory_pages := TRUE;
  1552.               ELSE
  1553.                 deallocate_expanded_memory_pages := FALSE;
  1554.             END;
  1555.  
  1556.  
  1557.           {main}
  1558.             BEGIN
  1559.               {Determine if EMM is installed}
  1560.               IF NOT (emm_installed) THEN
  1561.                 halt(1);
  1562.  
  1563.               {Determine if enough expanded memory pages exist for
  1564.                application}
  1565.               pages_needed := application_page_count;
  1566.               IF NOT (enough_unallocated_pages(pages_needed)) THEN
  1567.                 halt(1);
  1568.  
  1569.               {Allocate expanded memory pages}
  1570.               IF NOT (allocate_expanded_memory_pages(pages_needed,
  1571.                                                      emm_handle)) THEN
  1572.                 halt(1);
  1573.  
  1574.               {Map in the required pages}
  1575.               IF NOT (map_expanded_memory_pages(emm_handle, physical_page,
  1576.                                             logical_page) = PASSED) THEN
  1577.                 halt(1);
  1578.  
  1579.               {Get expanded memory page frame address}
  1580.               IF NOT (get_page_frame_base_address(pf_addr) = PASSED) THEN
  1581.                 halt(1);
  1582.  
  1583.               {Write to expanded memory}
  1584.               FOR offset := 0 to 16382 DO
  1585.               BEGIN
  1586.                 mem[pf_addr:offset] := 0;
  1587.               END
  1588.  
  1589.               {Return expanded memory pages before exiting}
  1590.               IF NOT (deallocate_expanded_memory_pages(emm_handle)) THEN
  1591.                 halt(1);
  1592.             END;
  1593.  
  1594.           Writing Programs That Use Expanded Memory                      22
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.           Example 3
  1601.  
  1602.                This program is written in Microsoft's macro assembler.
  1603.  
  1604.  
  1605.           CODE SEGMENT
  1606.                ASSUME CS:CODE, DS:CODE
  1607.  
  1608.           MOV   AX,CS
  1609.           MOV   DX,AX
  1610.                .
  1611.                .
  1612.                .
  1613.           check_emm_installed:
  1614.  
  1615.           MOV   AH,35h                  ; AH = DOS get interrupt vector
  1616.                                         ; function
  1617.           MOV   AL,67h                  ; AL = EMM interrupt vector number
  1618.           INT   21h
  1619.           MOV   DI,0Ah                  ; ES:DI points to where device     
  1620.                                         ; name should be
  1621.           LEA   SI,EMM_device_name      ; DS:SI points to ASCII string     
  1622.                                         ; containing EMM device name
  1623.  
  1624.           MOV   CX,device_name_length   ; set up loop counter for string op
  1625.           CLD                           ; set up direction flag for forward
  1626.           REPE  CMPSB                   ; Compare the strings
  1627.           JNE   exit                    ; IF strings not equal THEN exit
  1628.                                         ; ELSE
  1629.           check_enough_unallocated_pages:
  1630.  
  1631.           MOV   AH,41h                  ;    AH = EMM get unallocated page
  1632.                                         ;    count function code
  1633.           INT   67h
  1634.           OR    AH,AH                   ; Check EMM status
  1635.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  1636.                                         ; ELSE
  1637.           allocate_expanded_memory_pages:
  1638.  
  1639.           MOV   AH,43h                  ;    AH = EMM allocate pages
  1640.                                         ;    function code
  1641.           MOV   BX,2                    ;    BX = number of pages needed
  1642.           INT   67h
  1643.           OR    AH,AH                   ; Check EMM status
  1644.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  1645.                                         ; ELSE
  1646.           MOV   emm_handle,DX           ;    save EMM handle
  1647.  
  1648.           map_expanded_memory_pages:
  1649.  
  1650.           MOV   AH,44h                  ; AH = EMM map pages function
  1651.           MOV   DX,emm_handle           ; DX = application's handle
  1652.  
  1653.           Writing Programs That Use Expanded Memory                      23
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.           map_0_to_0:
  1660.  
  1661.           MOV   BX,0                    ; BX = logical page 0
  1662.           MOV   AL,0                    ; AL = physical page 0
  1663.           INT   67h
  1664.           OR    AH,AH                   ; Check EMM status
  1665.           JNZ   emm_error_handler       ; If error THEN goto error handler
  1666.                                         ; ELSE
  1667.           get_page_frame_address:
  1668.  
  1669.           MOV   AH,41h                  ; AH = EMM get page frame base
  1670.                                         ; address function
  1671.           INT   67h
  1672.           OR    AH,AH                   ; Check EMM status
  1673.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  1674.           MOV   pf_addr,BX              ; ELSE save pf_addr
  1675.  
  1676.           write_to_expanded_memory:     ; Write zeros to memory mapped at
  1677.                                         ; physical page 0
  1678.           MOV   AX,pf_addr
  1679.           MOV   ES,AX                   ; ES points to physical page 0
  1680.           MOV   DI,0                    ; DI indexes into physical page 0
  1681.           MOV   AL,0                    ; Initialize AL from string STOSB
  1682.           MOV   CX,4000h                ; Initialize loop counter to length 
  1683.                                         ; of expanded memory page size
  1684.           CLD                           ; set up direction flag for forward
  1685.           REP   STOSB
  1686.  
  1687.           deallocate_pages:
  1688.  
  1689.           MOV   AH,45h                  ; AH = EMM deallocate pages        
  1690.                                         ; function
  1691.           MOV   DX,emm_handle
  1692.           INT   67h                     ; return handle's pages to EMM
  1693.           OR    AH,AH                   ; Check EMM status
  1694.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  1695.  
  1696.           exit:
  1697.  
  1698.           MOV   AH,4Ch                  ; AH = DOS exit function
  1699.           INT   21h                     ; return to DOS
  1700.  
  1701.  
  1702.           EMM_device_name DB 'EMMXXXX0' ; ASCII EMM device name string
  1703.  
  1704.           device_name_length EQU 8
  1705.  
  1706.           CODE ENDS
  1707.                END
  1708.  
  1709.  
  1710.  
  1711.  
  1712.           Writing Programs That Use Expanded Memory                      24
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.           Example 4
  1719.  
  1720.                This program is an example of how to exchange a 256K-byte
  1721.                block of data from conventional memory to expanded memory.
  1722.  
  1723.  
  1724.           CODE SEGMENT
  1725.                ASSUME CS:CODE, DS:CODE
  1726.                .
  1727.                .
  1728.                .
  1729.           xchg_packet_set_up:
  1730.  
  1731.           ;DS:SI = xchg_packet
  1732.  
  1733.           MOV   AX,SEG xchg_packet
  1734.           MOV   DS,AX
  1735.           MOV   SI,OFFSET xchg_packet
  1736.  
  1737.           ;Moving 256K of data from conventional memory to expanded memory
  1738.  
  1739.           MOV   WORD PTR [SI].region_length[0],0
  1740.           MOV   WORD PTR [SI].region_length[2],4
  1741.           MOV   [SI].src_mem_type,0
  1742.           MOV   [SI].dest_mem_type,1
  1743.  
  1744.           ;starting at segment: 4000h, offset: 0
  1745.  
  1746.           MOV   [SI].src_init_seg_page,4000h
  1747.           MOV   [SI].src_init_offset,0
  1748.  
  1749.           ;Move data into expanded memory logical page 0, offset 0.
  1750.  
  1751.           MOV   [SI].dest_init_seg_page,0
  1752.           MOV   [SI].dest_init_offset,0
  1753.  
  1754.           ;Initialize for future compatibility
  1755.  
  1756.           MOV   [SI].src_handle,0
  1757.  
  1758.           ;Need handle for expanded memory destination.
  1759.  
  1760.           MOV   DX,emm_handle
  1761.           MOV   [SI].dest_handle,DX
  1762.  
  1763.           ;AX = EMM Exchange Memory function
  1764.  
  1765.           MOV   AX,5701h
  1766.           INT   67h
  1767.           OR    AH,AH
  1768.           JNZ   emm_error_handler
  1769.  
  1770.  
  1771.           Writing Programs That Use Expanded Memory                      25
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.           xchg_struct                    STRUC
  1778.              region_length               DD ?
  1779.              src_mem_type                DB ?
  1780.              src_handle                  DW ?
  1781.              src_init_offset             DW ?
  1782.              src_init_seg_page           DW ?
  1783.              dest_mem_type               DB ?
  1784.              dest_handle                 DW ?
  1785.              dest_init_offset            DW ?
  1786.              dest_init_seg_page          DW ?
  1787.           xchg_struct                    ENDS
  1788.  
  1789.           xchg_packet                    xchg_struct
  1790.  
  1791.           CODE  ENDS
  1792.                 END
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.           Writing Programs That Use Expanded Memory                      26
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.           Chapter 3
  1837.           EMM FUNCTIONS
  1838.  
  1839.  
  1840.                This chapter provides you with a standardized set of
  1841.                expanded memory functions.  Because they are standardized,
  1842.                you avoid potential compatibility problems with other
  1843.                expanded memory programs that also adhere to the memory
  1844.                manager specification.  Programs that deal directly with the
  1845.                hardware or that don't adhere to this specification will be
  1846.                incompatible.
  1847.  
  1848.                Table 3-1 presents a sequential list of the EMM functions. 
  1849.                The remainder of this chapter provides detailed descriptions
  1850.                of each function.
  1851.  
  1852.  
  1853.           Table 3-1.  List of EMM Functions
  1854.           ----------------------------------------------------------------
  1855.  
  1856.           Number             Function Name                Hex Value   Page
  1857.  
  1858.           ----------------------------------------------------------------
  1859.  
  1860.              1    Get Status                                40h         30
  1861.  
  1862.              2    Get Page Frame Address                    41h         31
  1863.  
  1864.              3    Get Unallocated Page Count                42h         33
  1865.  
  1866.              4    Allocate Pages                            43h         35
  1867.  
  1868.              5    Map/Unmap Handle Page                     44h         39
  1869.  
  1870.              6    Deallocate Pages                          45h         42
  1871.  
  1872.              7    Get Version                               46h         44
  1873.  
  1874.              8    Save Page Map                             47h         46
  1875.  
  1876.              9    Restore Page Map                          48h         48
  1877.  
  1878.             10    Reserved                                  49h         50
  1879.  
  1880.             11    Reserved                                  4Ah         51
  1881.  
  1882.             12    Get Handle Count                          4Bh         52
  1883.  
  1884.             13    Get Handle Pages                          4Ch         54
  1885.  
  1886.             14    Get All Handle Pages                      4Dh         56
  1887.  
  1888.  
  1889.           EMM Functions                                                  27
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.           Table 3-1.  List of EMM Functions (continued)
  1896.           ----------------------------------------------------------------
  1897.  
  1898.           Number             Function Name                Hex Value   Page
  1899.  
  1900.           ----------------------------------------------------------------
  1901.  
  1902.             15    Get Page Map                              4E00h       58
  1903.                   Set Page Map                              4E01h       60
  1904.                   Get & Set Page Map                        4E02h       62
  1905.                   Get Size of Page Map Save Array           4E03h       64
  1906.  
  1907.             16    Get Partial Page Map                      4F00h       66
  1908.                   Set Partial Page Map                      4F01h       69
  1909.                   Get Size of Partial Page Map
  1910.                      Save Array                             4F02h       71
  1911.  
  1912.             17    Map/Unmap Multiple Handle Pages
  1913.                   (Physical page number mode)               5000h       75
  1914.                   Map/Unmap Multiple Handle Pages
  1915.                   (Segment address mode)                    5001h       78
  1916.  
  1917.             18    Reallocate Pages                          51h         81
  1918.  
  1919.             19    Get Handle Attribute                      5200h       85
  1920.                   Set Handle Attribute                      5201h       87
  1921.                   Get Handle Attribute Capability           5202h       89
  1922.  
  1923.             20    Get Handle Name                           5300h       91
  1924.                   Set Handle Name                           5301h       93
  1925.  
  1926.             21    Get Handle Directory                      5400h       95
  1927.                   Search for Named Handle                   5401h       98
  1928.                   Get Total Handles                         5402h      100
  1929.  
  1930.             22    Alter Page Map & Jump
  1931.                   (Physical page number mode)               5500h      102
  1932.                   Alter Page Map & Jump
  1933.                   (Segment address mode)                    5501h      102
  1934.  
  1935.             23    Alter Page Map & Call
  1936.                   (Physical page number mode)               5600h      106
  1937.                   Alter Page Map & Call
  1938.                   (Segment address mode)                    5601h      106
  1939.                   Get Page Map Stack Space Size             5602h      111
  1940.  
  1941.             24    Move Memory Region                        5700h      113
  1942.                   Exchange Memory Region                    5701h      119
  1943.  
  1944.             25    Get Mappable Physical Address Array       5800h      126
  1945.                   Get Mappable Physical Address Array
  1946.                      Entries                                5801h      130
  1947.  
  1948.           EMM Functions                                                  28
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.           Table 3-1.  List of EMM Functions (continued)
  1955.           ----------------------------------------------------------------
  1956.  
  1957.           Number             Function Name                Hex Value   Page
  1958.  
  1959.           ----------------------------------------------------------------
  1960.  
  1961.             26    Get Expanded Memory Hardware
  1962.                      Information                            5900h      132
  1963.                   Get Unallocated Raw Page Count            5901h      136
  1964.  
  1965.             27    Allocate Raw Pages                        5Ah        138
  1966.  
  1967.             28    Get Alternate Map Register Set            5B00h      143
  1968.                   Set Alternate Map Register Set            5B01h      146
  1969.                   Get Alternate Map Save Array Size         5B02h      150
  1970.                   Allocate Alternate Map Register Set       5B03h      152
  1971.                   Deallocate Alternate Map Register Set     5B04h      155
  1972.                   Allocate DMA Register Set                 5B05h      157
  1973.                   Enable DMA on Alternate Map
  1974.                      Register Set                           5B06h      159
  1975.                   Disable DMA on Alternate Map
  1976.                      Register Set                           5B07h      162
  1977.                   Deallocate DMA Register Set               5B08h      164
  1978.  
  1979.             29    Prepare Expanded Memory Hardware
  1980.                      for Warmboot                           5Ch        166
  1981.  
  1982.             30    Enable OS/E Function Set                  5D00h      168
  1983.                   Disable OS/E Function Set                 5D01h      171
  1984.                   Return OS/E Access Key                    5D02h      174
  1985.  
  1986.           ----------------------------------------------------------------
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.           EMM Functions                                                  29
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.           Function 1. Get Status
  2014.  
  2015.  
  2016.  
  2017.           PURPOSE
  2018.  
  2019.                The Get Status function returns a status code indicating
  2020.                whether the memory manager is present and the hardware is
  2021.                working correctly.
  2022.  
  2023.  
  2024.           CALLING PARAMETERS
  2025.  
  2026.                AH = 40h
  2027.                    Contains the Get Status Function.
  2028.  
  2029.  
  2030.           REGISTERS MODIFIED
  2031.  
  2032.                AX
  2033.  
  2034.  
  2035.           STATUS
  2036.  
  2037.                AH = 0   SUCCESSFUL.
  2038.                    The manager is present in the system, and the hardware
  2039.                    is working correctly.
  2040.  
  2041.                AH = 80h   NON-RECOVERABLE.
  2042.                    The manager detected a malfunction in the memory manager
  2043.                    software.
  2044.  
  2045.                AH = 81h   NON-RECOVERABLE.
  2046.                    The manager detected a malfunction in the expanded
  2047.                    memory hardware.
  2048.  
  2049.                AH = 84h   NON-RECOVERABLE.
  2050.                    The function code passed to the memory manager is not
  2051.                    defined.
  2052.  
  2053.  
  2054.           EXAMPLE
  2055.  
  2056.           MOV   AH,40h                   ; load function code
  2057.           INT   67h                      ; call the memory manager
  2058.           OR    AH,AH                    ; check EMM status
  2059.           JNZ   emm_err_handler          ; jump to error handler on error
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.           EMM Functions                                                  30
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.           Function 2. Get Page Frame Address
  2073.  
  2074.  
  2075.  
  2076.           PURPOSE
  2077.  
  2078.                The Get Page Frame Address function returns the segment
  2079.                address where the page frame is located.
  2080.  
  2081.  
  2082.           CALLING PARAMETERS
  2083.  
  2084.                AH = 41h
  2085.                    Contains the Get Page Frame Address function.
  2086.  
  2087.  
  2088.           RESULTS
  2089.  
  2090.                These results are valid only if the status returned is zero.
  2091.  
  2092.                BX = page frame segment address
  2093.                    Contains the segment address of the page frame.
  2094.  
  2095.  
  2096.           REGISTERS MODIFIED
  2097.  
  2098.                AX, BX
  2099.  
  2100.  
  2101.           STATUS
  2102.  
  2103.                AH = 0   SUCCESSFUL.
  2104.                    The manager has returned the page frame address in the
  2105.                    BX register.
  2106.  
  2107.                AH = 80h   NON-RECOVERABLE.
  2108.                    The manager detected a malfunction in the memory manager
  2109.                    software.
  2110.  
  2111.                AH = 81h   NON-RECOVERABLE.
  2112.                    The manager detected a malfunction in the expanded
  2113.                    memory hardware.
  2114.  
  2115.                AH = 84h   NON-RECOVERABLE.
  2116.                    The function code passed to the memory manager is not
  2117.                    defined.
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.           EMM Functions                                                  31
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.           Function 2. Get Page Frame Address
  2132.  
  2133.  
  2134.  
  2135.           EXAMPLE
  2136.  
  2137.           page_frame_segment             DW ?
  2138.  
  2139.           MOV   AH,41h                   ; load function code
  2140.           INT   67h                      ; call the memory manager
  2141.           OR    AH,AH                    ; check EMM status
  2142.           JNZ   emm_err_handler          ; jump to error handler on error
  2143.           MOV   page_frame_segment,BX    ; save page frame address
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.           EMM Functions                                                  32
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.           Function 3. Get Unallocated Page Count
  2191.  
  2192.  
  2193.  
  2194.           PURPOSE
  2195.  
  2196.                The Get Unallocated Page Count function returns the number
  2197.                of unallocated pages and the total number of expanded memory
  2198.                pages.
  2199.  
  2200.  
  2201.           CALLING PARAMETERS
  2202.  
  2203.                AH = 42h
  2204.                    Contains the Get Unallocated Page Count function.
  2205.  
  2206.  
  2207.           RESULTS
  2208.  
  2209.                These results are valid only if the status returned is zero.
  2210.  
  2211.                BX = unallocated pages
  2212.                    The number of expanded memory pages that are currently
  2213.                    available for use (unallocated).
  2214.  
  2215.                DX = total pages
  2216.                    The total number of expanded memory pages.
  2217.  
  2218.  
  2219.           REGISTERS MODIFIED
  2220.  
  2221.                AX, BX, DX
  2222.  
  2223.  
  2224.           STATUS
  2225.  
  2226.                AH = 0   SUCCESSFUL.
  2227.                    The manager has returned the number of unallocated pages
  2228.                    and the number of total pages in expanded memory.
  2229.  
  2230.                AH = 80h   NON-RECOVERABLE.
  2231.                    The manager detected a malfunction in the memory manager
  2232.                    software.
  2233.  
  2234.                AH = 81h   NON-RECOVERABLE.
  2235.                    The manager detected a malfunction in the expanded
  2236.                    memory hardware.
  2237.  
  2238.                AH = 84h   NON-RECOVERABLE.
  2239.                    The function code passed to the memory manager is not
  2240.                    defined.
  2241.  
  2242.  
  2243.           EMM Functions                                                  33
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.           Function 3. Get Unallocated Page Count
  2250.  
  2251.  
  2252.  
  2253.           EXAMPLE
  2254.  
  2255.           un_alloc_pages                 DW ?
  2256.           total_pages                    DW ?
  2257.  
  2258.           MOV   AH,42h                   ; load function code
  2259.           INT   67h                      ; call the memory manager
  2260.           OR    AH,AH                    ; check EMM status
  2261.           JNZ   emm_err_handler          ; jump to error handler on error
  2262.           MOV   un_alloc_pages,BX        ; save unallocated page count
  2263.           MOV   total_pages,DX           ; save total page count
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.           EMM Functions                                                  34
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.           Function 4. Allocate Pages
  2309.  
  2310.  
  2311.  
  2312.                The Allocate Pages function allocates the number of pages
  2313.                requested and assigns a unique EMM handle to these pages. 
  2314.                The EMM handle owns these pages until the application
  2315.                deallocates them.
  2316.  
  2317.                Handles which are assigned using this function will have
  2318.                16K-byte pages, the size of a standard expanded memory page. 
  2319.                If the expanded memory board hardware isn't able to supply
  2320.                16K-byte pages, it will emulate them by combining multiple
  2321.                non-standard size pages to form a single 16K-byte page.  All
  2322.                application programs and functions that use the handles this
  2323.                function returns will deal with 16K-byte pages.
  2324.  
  2325.                The numeric value of the handles the EMM returns are in the
  2326.                range of 1 to 255 decimal (0001h to 00FFh).  Also, the
  2327.                uppermost byte of the handle will be zero and cannot be used
  2328.                by the application.
  2329.  
  2330.                Allocating zero pages to a handle is valid in this version
  2331.                of the expanded memory manager.  An application may obtain
  2332.                as many handles as it needs without allocating expanded
  2333.                memory to them until the memory is needed.  A memory manager
  2334.                should be able to supply up to 255 handles.  An application
  2335.                can use Function 21 to find out how many handles an EMM
  2336.                supports.
  2337.  
  2338.           Note............................................................
  2339.                This note affects expanded memory manager implementors and
  2340.                operating system developers only.  Applications should not
  2341.                use the following characteristics of the memory manager.  An
  2342.                application violating this rule will be incompatible with
  2343.                future versions of Microsoft's operating systems and
  2344.                environments.
  2345.  
  2346.                To be compatible with this specification, an expanded memory
  2347.                manager will provide a special handle which is available to
  2348.                the operating system only.  This handle will have a value of
  2349.                0000h and will have a set of pages allocated to it when the
  2350.                expanded memory manager driver installs.  The pages that the
  2351.                memory manager will automatically allocate to handle 0000h
  2352.                are those that backfill conventional memory.  Typically,
  2353.                this backfill occurs between addresses 40000h (256K) and
  2354.                9FFFFh (640K).  However, the range can extend below and
  2355.                above this limit if the hardware and memory manager have the
  2356.                capability.
  2357.  
  2358.  
  2359.  
  2360.  
  2361.           EMM Functions                                                  35
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.           Function 4. Allocate Pages
  2368.  
  2369.  
  2370.  
  2371.                An operating system won't have to invoke Function 4 to
  2372.                obtain this handle because it can assume the handle already
  2373.                exists and is available for use immediately after the
  2374.                expanded memory device driver installs.  When an operating
  2375.                system wants to use this handle, it uses the special handle
  2376.                value of 0000h.  The operating system will be able to invoke
  2377.                any EMM function using this special handle value.  To
  2378.                allocate pages to this handle, the operating system need
  2379.                only invoke Function 18 (Reallocate Pages).
  2380.  
  2381.                There are two special cases for this handle:
  2382.  
  2383.                1.  Function 4 (Allocate Pages).  This function must never
  2384.                    return zero as a handle value.  Applications must always
  2385.                    invoke Function 4 to allocate pages and obtain a handle
  2386.                    which identifies the pages which belong to it.  Since
  2387.                    Function 4 never returns a handle value of zero, an
  2388.                    application will never gain access to this special
  2389.                    handle.
  2390.  
  2391.                2.  Function 6 (Deallocate Pages).  If the operating system
  2392.                    uses it to deallocate the pages which are allocated to
  2393.                    this special handle, the pages the handle owns will be
  2394.                    returned to the manager for use.  But the handle will
  2395.                    not be available for reassignment.  The manager should
  2396.                    treat a deallocate pages function request for this
  2397.                    handle the same as a reallocate pages function request,
  2398.                    where the number of pages to reallocate to this handle
  2399.                    is zero.
  2400.  
  2401.  
  2402.           CALLING PARAMETERS
  2403.  
  2404.                AH = 43h
  2405.                    Contains the Allocate Pages function.
  2406.  
  2407.                BX = num_of_pages_to_alloc
  2408.                    Contains the number of pages you want your program to
  2409.                    allocate.
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.           EMM Functions                                                  36
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.           Function 4. Allocate Pages
  2427.  
  2428.  
  2429.  
  2430.           RESULTS
  2431.  
  2432.                These results are valid only if the status returned is zero.
  2433.  
  2434.                DX = handle
  2435.                    Contains a unique EMM handle.  Your program must use
  2436.                    this EMM handle (as a parameter) in any function that
  2437.                    requires it.  You can use up to 255 handles.  The
  2438.                    uppermost byte of the handle will be zero and cannot be
  2439.                    used by the application.
  2440.  
  2441.  
  2442.           REGISTERS MODIFIED
  2443.  
  2444.                AX, DX
  2445.  
  2446.  
  2447.           STATUS
  2448.  
  2449.                AH = 0   SUCCESSFUL.
  2450.                    The manager has allocated the requested pages to the
  2451.                    assigned EMM handle.
  2452.  
  2453.                AH = 80h   NON-RECOVERABLE.
  2454.                    The manager detected a malfunction in the memory manager
  2455.                    software.
  2456.  
  2457.                AH = 81h   NON-RECOVERABLE.
  2458.                    The manager detected a malfunction in the expanded
  2459.                    memory hardware.
  2460.  
  2461.                AH = 84h   NON-RECOVERABLE.
  2462.                    The function code passed to the memory manager is not
  2463.                    defined.
  2464.  
  2465.                AH = 85h   RECOVERABLE.
  2466.                    All EMM handles are being used.
  2467.  
  2468.                AH = 87h   RECOVERABLE.
  2469.                    There aren't enough expanded memory pages present in the
  2470.                    system to satisfy your program's request.
  2471.  
  2472.                AH = 88h   RECOVERABLE.
  2473.                    There aren't enough unallocated pages to satisfy your
  2474.                    program's request.
  2475.  
  2476.  
  2477.  
  2478.  
  2479.           EMM Functions                                                  37
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.           Function 4. Allocate Pages
  2486.  
  2487.  
  2488.  
  2489.           EXAMPLE
  2490.  
  2491.           num_of_pages_to_alloc          DW ?
  2492.           emm_handle                     DW ?
  2493.  
  2494.           MOV   BX,num_of_pages_to_alloc ; load number of pages needed
  2495.           MOV   AH,43h                   ; load function code
  2496.           INT   67h                      ; call the memory manager
  2497.           OR    AH,AH                    ; check EMM status
  2498.           JNZ   emm_err_handler          ; jump to error handler on error
  2499.           MOV   emm_handle,DX            ; save EMM handle
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.           EMM Functions                                                  38
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.           Function 5. Map/Unmap Handle Pages
  2545.  
  2546.  
  2547.  
  2548.           PURPOSE
  2549.  
  2550.                The Map/Unmap Handle Page function maps a logical page at a
  2551.                specific physical page anywhere in the mappable regions of
  2552.                system memory.  The lowest valued physical page numbers are
  2553.                associated with regions of memory outside the conventional
  2554.                memory range.  Use Function 25 (Get Mappable Physical
  2555.                Address Array) to determine which physical pages within a
  2556.                system are mappable and determine the segment addresses
  2557.                which correspond to a specific physical page number. 
  2558.                Function 25 provides a cross reference between physical page
  2559.                numbers and segment addresses.
  2560.  
  2561.                This function can also unmap physical pages, making them
  2562.                inaccessible for reading or writing.  You unmap a physical
  2563.                page by setting its associated logical page to FFFFh.
  2564.  
  2565.                You might unmap an entire set of mapped pages, for example,
  2566.                before loading and executing a program.  Doing so ensures
  2567.                the loaded program, if it accesses expanded memory, won't
  2568.                access the pages your program has mapped.  However, you must
  2569.                save the mapped context before you unmap the physical pages. 
  2570.                This enables you to restore it later so you can access the
  2571.                memory you mapped there.  To save the mapping context, use
  2572.                Function 8, 15, or 16.  To restore the mapping context, use
  2573.                Function 9, 15, or 16.
  2574.  
  2575.                The handle determines what type of pages are being mapped. 
  2576.                Logical pages allocated by Function 4 are referred to as
  2577.                pages and are 16K bytes long.  Logical pages allocated by
  2578.                Function 27 are referred to as raw pages and might not be
  2579.                the same size as logical pages.
  2580.  
  2581.  
  2582.           CALLING PARAMETERS
  2583.  
  2584.                AH = 44h
  2585.                    Contains the Map Handle Page function.
  2586.  
  2587.                AL = physical_page_number
  2588.                    Contains the number of the physical page into which the
  2589.                    logical page number is to be mapped.  Physical pages are
  2590.                    numbered zero-relative.
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.           EMM Functions                                                  39
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.           Function 5. Map/Unmap Handle Pages
  2604.  
  2605.  
  2606.  
  2607.                BX = logical_page_number
  2608.                    Contains the number of the logical page to be mapped at
  2609.                    the physical page within the page frame.  Logical pages
  2610.                    are numbered zero-relative.  The logical page must be in
  2611.                    the range zero through (number of pages allocated to the
  2612.                    EMM handle - 1).  However, if BX contains logical page
  2613.                    number FFFFh, the physical page specified in AL will be
  2614.                    unmapped (be made inaccessible for reading or writing).
  2615.  
  2616.                DX = emm_handle
  2617.                    Contains the EMM handle your program received from
  2618.                    Function 4 (Allocate Pages).
  2619.  
  2620.  
  2621.           REGISTERS MODIFIED
  2622.  
  2623.                AX
  2624.  
  2625.  
  2626.           STATUS
  2627.  
  2628.                AH = 0   SUCCESSFUL.
  2629.                    The manager has mapped the page.  The page is ready to
  2630.                    be accessed.
  2631.  
  2632.                AH = 80h   NON-RECOVERABLE.
  2633.                    The manager detected a malfunction in the memory manager
  2634.                    software.
  2635.  
  2636.                AH = 81h   NON-RECOVERABLE.
  2637.                    The manager detected a malfunction in the expanded
  2638.                    memory hardware.
  2639.  
  2640.                AH = 83h   NON-RECOVERABLE.
  2641.                    The memory manager couldn't find the EMM handle your
  2642.                    program specified.
  2643.  
  2644.                AH = 84h   NON-RECOVERABLE.
  2645.                    The function code passed to the memory manager isn't
  2646.                    defined.
  2647.  
  2648.                AH = 8Ah   RECOVERABLE.
  2649.                    The logical page is out of the range of logical pages
  2650.                    which are allocated to the EMM handle.  This status is
  2651.                    also returned if a program attempts to map a logical
  2652.                    page when no logical pages are allocated to the handle.
  2653.  
  2654.  
  2655.  
  2656.           EMM Functions                                                  40
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.           Function 5. Map/Unmap Handle Pages
  2663.  
  2664.  
  2665.  
  2666.                AH = 8Bh   RECOVERABLE.
  2667.                    The physical page number is out of the range of allow-
  2668.                    able physical pages.  The program can recover by
  2669.                    attempting to map into memory at a physical page which
  2670.                    is within the range of allowable physical pages.
  2671.  
  2672.  
  2673.           EXAMPLE
  2674.  
  2675.           emm_handle                     DW ?
  2676.           logical_page_number            DW ?
  2677.           physical_page_number           DB ?
  2678.  
  2679.           MOV   DX,emm_handle            ; load EMM handle
  2680.           MOV   BX,logical_page_number   ; load logical page number
  2681.           MOV   AL,physical_page_number  ; load physical page number
  2682.           MOV   AH,44h                   ; load function code
  2683.           INT   67h                      ; call the memory manager
  2684.           OR    AH,AH                    ; check EMM status
  2685.           JNZ   emm_err_handler          ; jump to error handler on error
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.           EMM Functions                                                  41
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.           Function 6. Deallocate Pages
  2722.  
  2723.  
  2724.  
  2725.           PURPOSE
  2726.  
  2727.                Deallocate Pages deallocates the logical pages currently
  2728.                allocated to an EMM handle.  Only after the application
  2729.                deallocates these pages can other applications use them. 
  2730.                When a handle is deallocated, its name is set to all ASCII
  2731.                nulls (binary zeros).
  2732.  
  2733.           Note............................................................
  2734.                A program must perform this function before it exits to DOS. 
  2735.                If it doesn't, no other programs can use these pages or the
  2736.                EMM handle.  This means that a program using expanded memory
  2737.                should trap critical errors and control-break if there is a
  2738.                chance that the program will have allocated pages when
  2739.                either of these events occur.
  2740.  
  2741.  
  2742.           CALLING PARAMETERS
  2743.  
  2744.                AH = 45h
  2745.                    Contains the Deallocate Pages function.
  2746.  
  2747.                DX = handle
  2748.                    Contains the EMM handle returned by Function 4 (Allocate
  2749.                    Pages).
  2750.  
  2751.  
  2752.           REGISTERS MODIFIED
  2753.  
  2754.                AX
  2755.  
  2756.  
  2757.           STATUS
  2758.  
  2759.                AH = 0   SUCCESSFUL.
  2760.                    The manager has deallocated the pages previously allo-
  2761.                    cated to the EMM handle.
  2762.  
  2763.                AH = 80h   NON-RECOVERABLE.
  2764.                    The manager detected a malfunction in the memory manager
  2765.                    software.
  2766.  
  2767.                AH = 81h   NON-RECOVERABLE.
  2768.                    The manager detected a malfunction in the expanded
  2769.                    memory hardware.
  2770.  
  2771.                AH = 83h   NON-RECOVERABLE.
  2772.                    The manager couldn't find the specified EMM handle.
  2773.  
  2774.           EMM Functions                                                  42
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.           Function 6. Deallocate Pages
  2781.  
  2782.  
  2783.  
  2784.                AH = 84h   NON-RECOVERABLE.
  2785.                    The function code passed to the memory manager is not
  2786.                    defined.
  2787.  
  2788.                AH = 86h   RECOVERABLE.
  2789.                    The memory manager detected a save or restore page
  2790.                    mapping context error (Function 8 or 9).  There is a
  2791.                    page mapping register state in the save area for the
  2792.                    specified EMM handle.  Save Page Map (Function 8) placed
  2793.                    it there and a subsequent Restore Page Map (Function 9)
  2794.                    has not removed it.
  2795.  
  2796.                    If you have saved the mapping context, you must restore
  2797.                    it before you deallocate the EMM handle's pages.
  2798.  
  2799.  
  2800.           EXAMPLE
  2801.  
  2802.           emm_handle                     DW ?
  2803.  
  2804.           MOV   DX,emm_handle            ; load EMM handle
  2805.           MOV   AH,45h                   ; load function code
  2806.           INT   67h                      ; call the memory manager
  2807.           OR    AH,AH                    ; check EMM status
  2808.           JNZ   emm_err_handler          ; jump to error handler on error
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.           EMM Functions                                                  43
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.           Function 7. Get Version
  2840.  
  2841.  
  2842.  
  2843.           PURPOSE
  2844.  
  2845.                The Get Version function returns the version number of the
  2846.                memory manager software.
  2847.  
  2848.  
  2849.           CALLING PARAMETERS
  2850.  
  2851.                AH = 46h
  2852.                    Contains the Get Version function.
  2853.  
  2854.  
  2855.           RESULTS
  2856.  
  2857.                These results are valid only if the status returned is zero.
  2858.  
  2859.                AL = version number
  2860.                    Contains the memory manager's version number in binary
  2861.                    coded decimal (BCD) format.  The upper four bits contain
  2862.                    the integer digit of the version number.  The lower four
  2863.                    bits contain the fractional digit of version number. 
  2864.                    For example, version 4.0 is represented like this:
  2865.  
  2866.                                       0100 0000
  2867.                                         /   \
  2868.                                        4  .  0
  2869.  
  2870.  
  2871.           REGISTERS MODIFIED
  2872.  
  2873.                AX
  2874.  
  2875.  
  2876.           STATUS
  2877.  
  2878.                AH = 0   SUCCESSFUL.
  2879.                    The manager is present in the system and the hardware is
  2880.                    working correctly.
  2881.  
  2882.                AH = 80h   NON-RECOVERABLE.
  2883.                    The manager detected a malfunction in the memory manager
  2884.                    software.
  2885.  
  2886.                AH = 81h   NON-RECOVERABLE.
  2887.                    The manager detected a malfunction in the expanded
  2888.                    memory hardware.
  2889.  
  2890.  
  2891.  
  2892.           EMM Functions                                                  44
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.           Function 7. Get Version
  2899.  
  2900.  
  2901.  
  2902.                AH = 84h   NON-RECOVERABLE.
  2903.                    The function code passed to the memory manager is not
  2904.                    defined.
  2905.  
  2906.  
  2907.           EXAMPLE
  2908.  
  2909.           emm_version                    DB ?
  2910.  
  2911.           MOV   AH,46h                   ; load function code
  2912.           INT   67h                      ; call the memory manager
  2913.           OR    AH,AH                    ; check EMM status
  2914.           JNZ   emm_err_handler          ; jump to error handler on error
  2915.           MOV   emm_version,AL           ; save version number
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.           EMM Functions                                                  45
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.           Function 8. Save Page Map
  2958.  
  2959.  
  2960.  
  2961.           PURPOSE
  2962.  
  2963.                Save Page Map saves the contents of the page mapping
  2964.                registers on all expanded memory boards in an internal save
  2965.                area.  The function is typically used to save the memory
  2966.                mapping context of the EMM handle that was active when a
  2967.                software or hardware interrupt occurred.  (See Function 9,
  2968.                Restore Page Map, for the restore operation.)
  2969.  
  2970.                If you're writing a resident program, an interrupt service
  2971.                routine, or a device driver that uses expanded memory, you
  2972.                must save the state of the mapping hardware.  You must save
  2973.                this state because application software using expanded
  2974.                memory may be running when your program is invoked by a
  2975.                hardware interrupt, a software interrupt, or DOS.
  2976.  
  2977.                The Save Page Map function requires the EMM handle that was
  2978.                assigned to your resident program, interrupt service
  2979.                routine, or device driver at the time it was initialized. 
  2980.                This is not the EMM handle that the application software was
  2981.                using when your software interrupted it.
  2982.  
  2983.                The Save Page Map function saves the state of the map
  2984.                registers for only the 64K-byte page frame defined in
  2985.                versions 3.x of this specification.  Since all applications
  2986.                written to LIM versions 3.x require saving the map register
  2987.                state of only this 64K-byte page frame, saving the entire
  2988.                mapping state for a large number of mappable pages would be
  2989.                inefficient use of memory.  Applications that use a mappable
  2990.                memory region outside the LIM 3.x page frame should use
  2991.                Function 15 or 16 to save and restore the state of the map
  2992.                registers.
  2993.  
  2994.  
  2995.           CALLING PARAMETERS
  2996.  
  2997.                AH = 47h
  2998.                    Contains the Save Page Map function.
  2999.  
  3000.                DX = handle
  3001.                    Contains the EMM handle assigned to the interrupt
  3002.                    service routine that's servicing the software or
  3003.                    hardware interrupt.  The interrupt service routine needs
  3004.                    to save the state of the page mapping hardware before
  3005.                    mapping any pages.
  3006.  
  3007.  
  3008.  
  3009.  
  3010.           EMM Functions                                                  46
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.           Function 8. Save Page Map
  3017.  
  3018.  
  3019.  
  3020.           REGISTERS MODIFIED
  3021.  
  3022.                AX
  3023.  
  3024.  
  3025.           STATUS
  3026.  
  3027.                AH = 0   SUCCESSFUL.
  3028.                    The manager has saved the state of the page mapping
  3029.                    hardware.
  3030.  
  3031.                AH = 80h   NON-RECOVERABLE.
  3032.                    The manager detected a malfunction in the memory manager
  3033.                    software.
  3034.  
  3035.                AH = 81h   NON-RECOVERABLE.
  3036.                    The manager detected a malfunction in the expanded
  3037.                    memory hardware.
  3038.  
  3039.                AH = 83h   NON-RECOVERABLE.
  3040.                    The manager couldn't find the specified EMM handle.
  3041.  
  3042.                AH = 84h   NON-RECOVERABLE.
  3043.                    The function code passed to the memory manager is not
  3044.                    defined.
  3045.  
  3046.                AH = 8Ch   NON-RECOVERABLE.
  3047.                    There is no room in the save area to store the state of
  3048.                    the page mapping registers.  The state of the map
  3049.                    registers has not been saved.
  3050.  
  3051.                AH = 8Dh   CONDITIONALLY-RECOVERABLE.
  3052.                    The save area already contains the page mapping register
  3053.                    state for the EMM handle your program specified.
  3054.  
  3055.  
  3056.           EXAMPLE
  3057.  
  3058.           emm_handle                     DW ?
  3059.  
  3060.           MOV   DX,emm_handle            ; load EMM handle
  3061.           MOV   AH,47h                   ; load function code
  3062.           INT   67h                      ; call the memory manager
  3063.           OR    AH,AH                    ; check EMM status
  3064.           JNZ   emm_err_handler          ; jump to error handler on error
  3065.  
  3066.  
  3067.  
  3068.  
  3069.           EMM Functions                                                  47
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.           Function 9. Restore Page Map
  3076.  
  3077.  
  3078.  
  3079.           PURPOSE
  3080.  
  3081.                The Restore Page Map function restores the page mapping
  3082.                register contents on the expanded memory boards for a
  3083.                particular EMM handle.  This function lets your program
  3084.                restore the contents of the mapping registers its EMM handle
  3085.                saved.  (See Function 8, Save Page Map for the save opera-
  3086.                tion.)
  3087.  
  3088.                If you're writing a resident program, an interrupt service
  3089.                routine, or a device driver that uses expanded memory, you
  3090.                must restore the mapping hardware to the state it was in
  3091.                before your program took over.  You must save this state
  3092.                because application software using expanded memory might
  3093.                have been running when your program was invoked.
  3094.  
  3095.                The Restore Page Map function requires the EMM handle that
  3096.                was assigned to your resident program, interrupt service
  3097.                routine, or device driver at the time it was initialized. 
  3098.                This is not the EMM handle that the application software was
  3099.                using when your software interrupted it.
  3100.  
  3101.                The Restore Page Map function restores the state of the map
  3102.                registers for only the 64K-byte page frame defined in
  3103.                versions 3.x of this specification.  Since all applications
  3104.                written to LIM versions 3.x require restoring the map
  3105.                register state of only this 64K-byte page frame, restoring
  3106.                the entire mapping state for a large number of mappable
  3107.                pages would be inefficient use of memory.  Applications that
  3108.                use a mappable memory region outside the LIM 3.x page frame
  3109.                should use Function 15 or 16 to save and restore the state
  3110.                of the map registers.
  3111.  
  3112.  
  3113.           CALLING PARAMETERS
  3114.  
  3115.                AH = 48h
  3116.                    Contains the Restore Page Map function.
  3117.  
  3118.                DX = emm_handle
  3119.                    Contains the EMM handle assigned to the interrupt
  3120.                    service routine that's servicing the software or
  3121.                    hardware interrupt.  The interrupt service routine needs
  3122.                    to restore the state of the page mapping hardware.
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.           EMM Functions                                                  48
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.           Function 9. Restore Page Map
  3135.  
  3136.  
  3137.  
  3138.           REGISTERS MODIFIED
  3139.  
  3140.                AX
  3141.  
  3142.  
  3143.           STATUS
  3144.  
  3145.                AH = 0   SUCCESSFUL.
  3146.                    The manager has restored the state of the page mapping
  3147.                    registers.
  3148.  
  3149.                AH = 80h   NON-RECOVERABLE.
  3150.                    The manager detected a malfunction in the memory manager
  3151.                    software.
  3152.  
  3153.                AH = 81h   NON-RECOVERABLE.
  3154.                    The manager detected a malfunction in the expanded
  3155.                    memory hardware.
  3156.  
  3157.                AH = 83h   NON-RECOVERABLE.
  3158.                    The manager couldn't find the specified EMM handle.
  3159.  
  3160.                AH = 84h   NON-RECOVERABLE.
  3161.                    The function code passed to the memory manager is not
  3162.                    defined.
  3163.  
  3164.                AH = 8Eh   CONDITIONALLY-RECOVERABLE.
  3165.                    There is no page mapping register state in the save area
  3166.                    for the specified EMM handle.  Your program didn't save
  3167.                    the contents of the page mapping hardware, so Restore
  3168.                    Page can't restore it.
  3169.  
  3170.  
  3171.           EXAMPLE
  3172.  
  3173.           emm_handle                     DW ?
  3174.  
  3175.           MOV   DX,emm_handle            ; load EMM handle
  3176.           MOV   AH,48h                   ; load function code
  3177.           INT   67h                      ; call the memory manager
  3178.           OR    AH,AH                    ; check EMM status
  3179.           JNZ   emm_err_handler          ; jump to error handler on error
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.           EMM Functions                                                  49
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.           Function 10. Reserved
  3194.  
  3195.  
  3196.  
  3197.                In earlier versions of the Lotus/Intel/Microsoft Expanded
  3198.                Memory Specification, Function 10 returned the page mapping
  3199.                register I/O array.  This function is now reserved and new
  3200.                programs should not use it.
  3201.  
  3202.                Existing programs that use this function may still work
  3203.                correctly if the hardware is capable of supporting them. 
  3204.                However, programs that use Functions 16 through 30 in
  3205.                Version 4.0 of this specification must not use Functions 10
  3206.                and 11.  These functions won't work correctly if your
  3207.                program attempts to mix the use of the new functions
  3208.                (Functions 16 through 30) and Functions 10 and 11.  Func-
  3209.                tions 10 and 11 are specific to the hardware on Intel
  3210.                expanded memory boards and will not work correctly on all
  3211.                vendors' expanded memory boards.
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.           EMM Functions                                                  50
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.           Function 11. Reserved
  3253.  
  3254.  
  3255.  
  3256.                In earlier versions of the Lotus/Intel/Microsoft Expanded
  3257.                Memory Specification, Function 11 returned a page transla-
  3258.                tion array.  This function is now reserved and new programs
  3259.                should not use it.
  3260.  
  3261.                Existing programs that use this function may still work
  3262.                correctly if the hardware is capable of supporting them. 
  3263.                However, programs that use Functions 16 through 30 in
  3264.                Version 4.0 of this specification must not use Functions 10
  3265.                and 11.  These functions won't work correctly if your
  3266.                program attempts to mix the use of the new functions
  3267.                (Functions 16 through 30) and Functions 10 and 11.  Func-
  3268.                tions 10 and 11 are specific to the hardware on Intel
  3269.                expanded memory boards and will not work correctly on all
  3270.                vendors' expanded memory boards.
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.           EMM Functions                                                  51
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.           Function 12. Get Handle Count
  3312.  
  3313.  
  3314.  
  3315.           PURPOSE
  3316.  
  3317.                The Get Handle Count function returns the number of open EMM
  3318.                handles (including the operating system handle 0) in the
  3319.                system.
  3320.  
  3321.  
  3322.           CALLING PARAMETERS
  3323.  
  3324.                AH = 4Bh
  3325.                    Contains the Get Handle Count function.
  3326.  
  3327.  
  3328.           RESULTS
  3329.  
  3330.                These results are valid only if the status returned is zero.
  3331.  
  3332.                BX = total_open_emm_handles
  3333.                    Contains the number of open EMM handles [including the
  3334.                    operating system handle (0)].  This number will not
  3335.                    exceed 255.
  3336.  
  3337.  
  3338.           REGISTERS MODIFIED
  3339.  
  3340.                AX, BX
  3341.  
  3342.  
  3343.           STATUS
  3344.  
  3345.                AH = 0   SUCCESSFUL.
  3346.                    The manager has returned the number of active EMM
  3347.                    handles.
  3348.  
  3349.                AH = 80h   NON-RECOVERABLE.
  3350.                    The manager detected a malfunction in the memory manager
  3351.                    software.
  3352.  
  3353.                AH = 81h   NON-RECOVERABLE.
  3354.                    The manager detected a malfunction in the expanded
  3355.                    memory hardware.
  3356.  
  3357.                AH = 84h   NON-RECOVERABLE.
  3358.                    The function code passed to the memory manager is not
  3359.                    defined.
  3360.  
  3361.  
  3362.  
  3363.  
  3364.           EMM Functions                                                  52
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.           Function 12. Get Handle Count
  3371.  
  3372.  
  3373.  
  3374.           EXAMPLE
  3375.  
  3376.           total_open_emm_handles              DW ?
  3377.  
  3378.           MOV   AH,4Bh                        ; load function code
  3379.           INT   67h                           ; call the memory manger
  3380.           OR    AH,AH                         ; check EMM status
  3381.           JNZ   emm_err_handler               ; jump to error handler on   
  3382.                                               ; error
  3383.           MOV   total_open_emm_handles,BX     ; save total active handle   
  3384.                                               ; count
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.           EMM Functions                                                  53
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.           Function 13. Get Handle Pages
  3430.  
  3431.  
  3432.  
  3433.           PURPOSE
  3434.  
  3435.                The Get Handle Pages function returns the number of pages
  3436.                allocated to a specific EMM handle.
  3437.  
  3438.  
  3439.           CALLING PARAMETERS
  3440.  
  3441.                AH = 4Ch
  3442.                    Contains the Get Handle Pages function.
  3443.  
  3444.                DX = emm_handle
  3445.                    Contains the EMM handle.
  3446.  
  3447.  
  3448.           RESULTS
  3449.  
  3450.                These results are valid only if the status returned is zero.
  3451.  
  3452.                BX = num_pages_alloc_to_emm_handle
  3453.                    Contains the number of logical pages allocated to the
  3454.                    specified EMM handle.  This number never exceeds 2048
  3455.                    because the memory manager allows a maximum of 2048
  3456.                    pages (32M bytes) of expanded memory.
  3457.  
  3458.  
  3459.           REGISTERS MODIFIED
  3460.  
  3461.                AX, BX
  3462.  
  3463.  
  3464.           STATUS
  3465.  
  3466.                AH = 0   SUCCESSFUL.
  3467.                    The manager has returned the number of pages allocated
  3468.                    to the EMM handle.
  3469.  
  3470.                AH = 80h   NON-RECOVERABLE.
  3471.                    The manager detected a malfunction in the memory manager
  3472.                    software.
  3473.  
  3474.                AH = 81h   NON-RECOVERABLE.
  3475.                    The manager detected a malfunction in the expanded
  3476.                    memory hardware.
  3477.  
  3478.                AH = 83h   NON-RECOVERABLE.
  3479.                    The manager couldn't find the specified EMM handle.
  3480.  
  3481.  
  3482.           EMM Functions                                                  54
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.           Function 13. Get Handle Pages
  3489.  
  3490.  
  3491.  
  3492.                AH = 84h   NON-RECOVERABLE.
  3493.                    The function code passed to the memory manager is not
  3494.                    defined.
  3495.  
  3496.  
  3497.           EXAMPLE
  3498.  
  3499.           emm_handle                          DW ?
  3500.           pages_alloc_to_handle               DW ?
  3501.  
  3502.           MOV   DX,emm_handle                 ; load EMM handle
  3503.           MOV   AH,4Ch                        ; load function code
  3504.           INT   67h                           ; call the memory manager
  3505.           OR    AH,AH                         ; check EMM status
  3506.           JNZ   emm_err_handle                ; jump to error handler on   
  3507.                                               ; error
  3508.           MOV   pages_alloc_to_handle,BX      ; save number of pages       
  3509.                                               ; allocated to specified     
  3510.                                               ; handle
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.           EMM Functions                                                  55
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.           Function 14. Get All Handle Pages
  3548.  
  3549.  
  3550.  
  3551.           PURPOSE
  3552.  
  3553.                The Get All Handle Pages function returns an array of the
  3554.                open EMM handles and the number of pages allocated to each
  3555.                one.
  3556.  
  3557.  
  3558.           CALLING PARAMETERS
  3559.  
  3560.                AH = 4Dh
  3561.                    Contains the Get All Handle Pages function.
  3562.  
  3563.                    handle_page_struct              STRUC
  3564.                        emm_handle                  DW ?
  3565.                        pages_alloc_to_handle       DW ?
  3566.                    handle_page_struct              ENDS
  3567.  
  3568.                ES:DI = pointer to handle_page
  3569.                    Contains a pointer to an array of structures where a
  3570.                    copy of all open EMM handles and the number of pages
  3571.                    allocated to each will be stored.  Each structure has
  3572.                    these two members:
  3573.  
  3574.                    .emm_handle
  3575.                        The first member is a word which contains the value
  3576.                        of the open EMM handle.  The values of the handles
  3577.                        this functions returns will be in the range of 0 to
  3578.                        255 decimal (0000h to 00FFh).  The uppermost byte of
  3579.                        the handle is always zero.
  3580.  
  3581.                    .pages_alloc_to_handle
  3582.                        The second member is a word which contains the
  3583.                        number of pages allocated to the open EMM handle.
  3584.  
  3585.  
  3586.           RESULTS
  3587.  
  3588.                These results are valid only if the status returned is zero.
  3589.  
  3590.                BX = total_open_emm_handles
  3591.                    Contains the number of open EMM handles (including the
  3592.                    operating system handle [0]).  The number cannot be zero
  3593.                    because the operating system handle is always active and
  3594.                    cannot be deallocated.  This number will not exceed 255.
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.           EMM Functions                                                  56
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.           Function 14. Get All Handle Pages
  3607.  
  3608.  
  3609.  
  3610.           REGISTERS MODIFIED
  3611.  
  3612.                AX, BX
  3613.  
  3614.  
  3615.           STATUS
  3616.  
  3617.                AH = 0   SUCCESSFUL.
  3618.                    The manager has returned the array.
  3619.  
  3620.                AH = 80h   NON-RECOVERABLE.
  3621.                    The manager detected a malfunction in the memory manager
  3622.                    software.
  3623.  
  3624.                AH = 81h   NON-RECOVERABLE.
  3625.                    The manager detected a malfunction in the expanded
  3626.                    memory hardware.
  3627.  
  3628.                AH = 84h   NON-RECOVERABLE.
  3629.                    The function code passed to the memory manager is not
  3630.                    defined.
  3631.  
  3632.  
  3633.           EXAMPLE
  3634.  
  3635.           handle_page                    handle_page_struct 255 DUP (?)
  3636.           total_open_handles             DW ?
  3637.  
  3638.           MOV   AX,SEG handle_page
  3639.           MOV   ES,AX
  3640.           LEA   DI,handle_page           ; ES:DI points to handle_page
  3641.           MOV   AH,4Dh                   ; load function code
  3642.           INT   67h                      ; call the memory manager
  3643.           OR    AH,AH                    ; check the EMM status
  3644.           JNZ   emm_err_handler          ; jump to error handler on error
  3645.           MOV   total_open_handles,BX    ; save total open handle count
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.           EMM Functions                                                  57
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.           Function 15. Get/Set Page Map
  3666.           Get Page Map subfunction
  3667.  
  3668.  
  3669.  
  3670.           PURPOSE
  3671.  
  3672.                The Get Page Map subfunction saves the mapping context for
  3673.                all mappable memory regions (conventional and expanded) by
  3674.                copying the contents of the mapping registers from each
  3675.                expanded memory board to a destination array.  The applica-
  3676.                tion must pass a pointer to the destination array.  This
  3677.                subfunction doesn't require an EMM handle.
  3678.  
  3679.                Use this function instead of Functions 8 and 9 if you need
  3680.                to save or restore the mapping context but don't want (or
  3681.                have) to use a handle.
  3682.  
  3683.  
  3684.           CALLING PARAMETERS
  3685.  
  3686.                AX = 4E00h
  3687.                    Contains the Get Page Map subfunction.
  3688.  
  3689.                ES:DI = dest_page_map
  3690.                    Contains a pointer to the destination array address in
  3691.                    segment:offset format.  Use the Get Size of Page Map
  3692.                    Save Array subfunction to determine the size of the
  3693.                    desired array.
  3694.  
  3695.  
  3696.           RESULTS
  3697.  
  3698.                These results are valid only if the status returned is zero.
  3699.  
  3700.                dest_page_map
  3701.                    The array contains the state of all the mapping regis-
  3702.                    ters on all boards in the system.  It also contains any
  3703.                    additional information necessary to restore the boards
  3704.                    to their original state when the program invokes a Set
  3705.                    subfunction.
  3706.  
  3707.  
  3708.           REGISTERS MODIFIED
  3709.  
  3710.                AX
  3711.  
  3712.  
  3713.           STATUS
  3714.  
  3715.                AH = 0   SUCCESSFUL.
  3716.                    The manager has returned the array.
  3717.  
  3718.           EMM Functions                                                  58
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.           Function 15. Get/Set Page Map
  3725.           Get Page Map subfunction
  3726.  
  3727.  
  3728.  
  3729.                AH = 80h   NON-RECOVERABLE.
  3730.                    The manager detected a malfunction in the memory manager
  3731.                    software.
  3732.  
  3733.                AH = 81h   NON-RECOVERABLE.
  3734.                    The manager detected a malfunction in the expanded
  3735.                    memory hardware.
  3736.  
  3737.                AH = 84h   NON-RECOVERABLE.
  3738.                    The function code passed to the memory manager is not
  3739.                    defined.
  3740.  
  3741.                AH = 8Fh   NON-RECOVERABLE.
  3742.                    The subfunction parameter is invalid.
  3743.  
  3744.  
  3745.           EXAMPLE
  3746.  
  3747.           dest_page_map                  DB ? DUP (?)
  3748.  
  3749.           MOV   AX,SEG dest_page_map
  3750.           MOV   ES,AX
  3751.           LEA   DI,dest_page_map         ; ES:DI points to dest_page_map
  3752.           MOV   AX,4E00h                 ; load function code
  3753.           INT   67h                      ; call the memory manager
  3754.           OR    AH,AH                    ; check EMM status
  3755.           JNZ   emm_err_handler          ; jump to error handler on error
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.           EMM Functions                                                  59
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.           Function 15. Get/Set Page Map
  3784.           Set Page Map subfunction
  3785.  
  3786.  
  3787.  
  3788.           PURPOSE
  3789.  
  3790.                The Set Page Map subfunction restores the mapping context
  3791.                for all mappable memory regions (conventional and expanded)
  3792.                by copying the contents of a source array into the mapping
  3793.                registers on each expanded memory board in the system.  The
  3794.                application must pass a pointer to the source array.  This
  3795.                subfunction doesn't require an EMM handle.
  3796.  
  3797.                Use this function instead of Functions 8 and 9 if you need
  3798.                to save or restore the mapping context but don't want (or
  3799.                have) to use a handle.
  3800.  
  3801.  
  3802.           CALLING PARAMETERS
  3803.  
  3804.                AX = 4E01h
  3805.                    Contains the Set Page Map subfunction.
  3806.  
  3807.                DS:SI = source_page_map
  3808.                    Contains a pointer to the source array address in
  3809.                    segment:offset format.  The application must point to an
  3810.                    array which contains the mapping register state.  Use
  3811.                    the Get Size of Page Map Save Array subfunction to
  3812.                    determine the size of the desired array.
  3813.  
  3814.  
  3815.           REGISTERS MODIFIED
  3816.  
  3817.                AX
  3818.  
  3819.  
  3820.           STATUS
  3821.  
  3822.                AH = 0   SUCCESSFUL.
  3823.                    The manager has passed the array.
  3824.  
  3825.                AH = 80h   NON-RECOVERABLE.
  3826.                    The manager detected a malfunction in the memory manager
  3827.                    software.
  3828.  
  3829.                AH = 81h   NON-RECOVERABLE.
  3830.                    The manager detected a malfunction in the expanded
  3831.                    memory hardware.
  3832.  
  3833.  
  3834.  
  3835.  
  3836.           EMM Functions                                                  60
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.           Function 15. Get/Set Page Map
  3843.           Set Page Map subfunction
  3844.  
  3845.  
  3846.  
  3847.                AH = 84h   NON-RECOVERABLE.
  3848.                    The function code passed to the memory manager is not
  3849.                    defined.
  3850.  
  3851.                AH = 8Fh   NON-RECOVERABLE.
  3852.                    The subfunction parameter is invalid.
  3853.  
  3854.                AH = A3h   NON-RECOVERABLE.
  3855.                    The contents of the source array have been corrupted, or
  3856.                    the pointer passed to the subfunction is invalid.
  3857.  
  3858.  
  3859.           EXAMPLE
  3860.  
  3861.           source_page_map                DB ? DUP (?)
  3862.  
  3863.           MOV   AX,SEG source_page_map
  3864.           MOV   DS,AX
  3865.           LEA   SI,source_page_map       ; DS:SI points to source_page_map
  3866.           MOV   AX,4E01h                 ; load function code
  3867.           INT   67h                      ; call the memory manager
  3868.           OR    AH,AH                    ; check EMM status
  3869.           JNZ   emm_err_handler          ; jump to error handler on error
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.           EMM Functions                                                  61
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.           Function 15. Get/Set Page Map
  3902.           Get & Set Page Map subfunction
  3903.  
  3904.  
  3905.  
  3906.           PURPOSE
  3907.  
  3908.                The Get & Set Page Map subfunction simultaneously saves a
  3909.                current mapping context and restores a previous mapping
  3910.                context for all mappable memory regions (both conventional
  3911.                and expanded).  It first copies the contents of the mapping
  3912.                registers from each expanded memory board in the system into
  3913.                a destination array.  (The application must pass a pointer
  3914.                to the destination array.)  Then, the subfunction copies the
  3915.                contents of a source array into the mapping registers on
  3916.                each of the expanded memory boards.  (The application must
  3917.                pass a pointer to the source array.)
  3918.  
  3919.                Use this function instead of Functions 8 and 9 if you need
  3920.                to save or restore the mapping context but don't want (or
  3921.                have) to use a handle.
  3922.  
  3923.  
  3924.           CALLING PARAMETERS
  3925.  
  3926.                AX = 4E02h
  3927.                    Contains the Get & Set Page Map subfunction.
  3928.  
  3929.                ES:DI = dest_page_map
  3930.                    Contains a pointer to the destination array address in
  3931.                    segment:offset format.  The current contents of the map
  3932.                    registers will be saved in this array.
  3933.  
  3934.                DS:SI = source_page_map
  3935.                    Contains a pointer to the source array address in
  3936.                    segment:offset format.  The contents of this array will
  3937.                    be copied into the map registers.  The application must
  3938.                    point to an array which contains the mapping register
  3939.                    state.  This address is required only for the Set or Get
  3940.                    and Set subfunctions.
  3941.  
  3942.  
  3943.           RESULTS
  3944.  
  3945.                These results are valid only if the status returned is zero.
  3946.  
  3947.                dest_page_map
  3948.                    The array contains the mapping state.  It also contains
  3949.                    any additional information necessary to restore the
  3950.                    original state when the program invokes a Set subfunc-
  3951.                    tion.
  3952.  
  3953.  
  3954.           EMM Functions                                                  62
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.           Function 15. Get/Set Page Map
  3961.           Get & Set Page Map subfunction
  3962.  
  3963.  
  3964.  
  3965.           REGISTERS MODIFIED
  3966.  
  3967.                AX
  3968.  
  3969.  
  3970.           STATUS
  3971.  
  3972.                AH = 0   SUCCESSFUL.
  3973.                    The manager has returned and passed both arrays.
  3974.  
  3975.                AH = 80h   NON-RECOVERABLE.
  3976.                    The manager detected a malfunction in the memory manager
  3977.                    software.
  3978.  
  3979.                AH = 81h   NON-RECOVERABLE.
  3980.                    The manager detected a malfunction in the expanded
  3981.                    memory hardware.
  3982.  
  3983.                AH = 84h   NON-RECOVERABLE.
  3984.                    The function code passed to the memory manager is not
  3985.                    defined.
  3986.  
  3987.                AH = 8Fh   NON-RECOVERABLE.
  3988.                    The subfunction parameter is invalid.
  3989.  
  3990.                AH = A3h   NON-RECOVERABLE.
  3991.                    The contents of the source array have been corrupted, or
  3992.                    the pointer passed to the subfunction is invalid.
  3993.  
  3994.  
  3995.           EXAMPLE
  3996.  
  3997.           dest_page_map                  DB ? DUP (?)
  3998.  
  3999.           source_page_map                DB ? DUP (?)
  4000.  
  4001.           MOV   AX,SEG dest_page_map
  4002.           MOV   ES,AX
  4003.           MOV   AX,SEG source_page_map
  4004.           MOV   DS,AX
  4005.           LEA   DI,dest_page_map         ; ES:DI points to dest_page_map
  4006.           LEA   SI,source_page_map       ; DS:SI points to source_page_map
  4007.           MOV   AX,4E02h                 ; load function code
  4008.           INT   67h                      ; call the memory manager
  4009.           OR    AH,AH                    ; check EMM status
  4010.           JNZ   emm_err_handler          ; jump to error handler on error
  4011.  
  4012.  
  4013.           EMM Functions                                                  63
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.           Function 15. Get/Set Page Map
  4020.           Get Size of Page Map Save Array subfunction
  4021.  
  4022.  
  4023.  
  4024.           PURPOSE
  4025.  
  4026.                The Get Size of Page Map Save Array subfunction returns the
  4027.                storage requirements for the array passed by the other three
  4028.                subfunctions.  This subfunction doesn't require an EMM
  4029.                handle.
  4030.  
  4031.  
  4032.           CALLING PARAMETERS
  4033.  
  4034.                AX = 4E03h
  4035.                    Contains the Get Size of Page Map Save Array subfunc-
  4036.                    tion.  The size of this array depends on how the
  4037.                    expanded memory system is configured and how the
  4038.                    expanded memory manager is implemented.  Therefore, the
  4039.                    size must be determined after the memory manager is
  4040.                    loaded.
  4041.  
  4042.  
  4043.           RESULTS
  4044.  
  4045.                These results are valid only if the status returned is zero.
  4046.  
  4047.                AL = size_of_array
  4048.                    Contains the number of bytes that will be transferred to
  4049.                    the memory area an application supplies whenever a
  4050.                    program requests the Get, Set, or Get and Set subfunc-
  4051.                    tions.
  4052.  
  4053.  
  4054.           REGISTERS MODIFIED
  4055.  
  4056.                AX
  4057.  
  4058.  
  4059.           STATUS
  4060.  
  4061.                AH = 0   SUCCESSFUL.
  4062.                    The manager has returned the array size.
  4063.  
  4064.                AH = 80h   NON-RECOVERABLE.
  4065.                    The manager detected a malfunction in the memory manager
  4066.                    software.
  4067.  
  4068.                AH = 81h   NON-RECOVERABLE.
  4069.                    The manager detected a malfunction in the expanded
  4070.                    memory hardware.
  4071.  
  4072.           EMM Functions                                                  64
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.           Function 15. Get/Set Page Map
  4079.           Get Size of Page Map Save Array subfunction
  4080.  
  4081.  
  4082.  
  4083.                AH = 84h   NON-RECOVERABLE.
  4084.                    The function code passed to the memory manager is not
  4085.                    defined.
  4086.  
  4087.                AH = 8Fh   NON-RECOVERABLE.
  4088.                    The subfunction parameter is invalid.
  4089.  
  4090.  
  4091.           EXAMPLE
  4092.  
  4093.           size_of_array                  DB ?
  4094.  
  4095.           MOV   AX,4E03h                 ; load function code
  4096.           INT   67h                      ; call the memory manager
  4097.           OR    AH,AH                    ; check EMM status
  4098.           JNZ   emm_err_handler          ; jump to error handler on error
  4099.           MOV   size_of_array,AL         ; save array size
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.           EMM Functions                                                  65
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  
  4137.           Function 16. Get/Set Partial Page Map
  4138.           Get Partial Page Map subfunction
  4139.  
  4140.  
  4141.  
  4142.           PURPOSE
  4143.  
  4144.                The Get Partial Page Map subfunction saves a partial mapping
  4145.                context for specific mappable memory regions in a system. 
  4146.                Because this function saves only a subset of the entire
  4147.                mapping context, it uses much less memory for the save area
  4148.                and may be potentially faster than Function 15.  The
  4149.                subfunction does this by copying the contents of selected
  4150.                mapping registers from each expanded memory board to a
  4151.                destination array.
  4152.  
  4153.                The application must pass a pair of pointers.  The first
  4154.                points to a structure which specifies which mappable
  4155.                segments to save; the second points to the destination
  4156.                array.
  4157.  
  4158.                Use this function instead of Functions 8 and 9 if you need
  4159.                to save or restore the mapping context but don't want (or
  4160.                have) to use a handle.
  4161.  
  4162.  
  4163.           CALLING PARAMETERS
  4164.  
  4165.                AX = 4F00h
  4166.                    Contains the Get Partial Page Map subfunction.
  4167.  
  4168.                    partial_page_map_struct         STRUC
  4169.                        mappable_segment_count      DW ?
  4170.                        mappable_segment            DW (?) DUP (?)
  4171.                    partial_page_map_struct         ENDS
  4172.  
  4173.                DS:SI = partial_page_map
  4174.                    Contains a pointer to a structure which specifies only
  4175.                    those mappable memory regions which are to have their
  4176.                    mapping context saved.  The structure members are
  4177.                    described below.
  4178.  
  4179.                    .mappable_segment_count
  4180.                        The first member is a word which specifies the
  4181.                        number of members in the word array which immediate-
  4182.                        ly follows it.
  4183.  
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.  
  4190.           EMM Functions                                                  66
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.           Function 16. Get/Set Partial Page Map
  4197.           Get Partial Page Map subfunction
  4198.  
  4199.  
  4200.  
  4201.                    .mappable_segment
  4202.                        The second member is a word array which contains the
  4203.                        segment addresses of the mappable memory regions
  4204.                        whose mapping contexts are to be saved.  The segment
  4205.                        address must be a mappable segment.  Use Function 25
  4206.                        to determine which segments are mappable.
  4207.  
  4208.                ES:DI = dest_array
  4209.                    Contains a pointer to the destination array address in
  4210.                    Segment:Offset format.  To determine the size of the
  4211.                    required array, see the Get Size of Partial Page Map
  4212.                    Save Array subfunction.
  4213.  
  4214.  
  4215.           RESULTS
  4216.  
  4217.                These results are valid only if the status returned is zero.
  4218.  
  4219.                dest_array
  4220.                    The array contains the partial mapping context and any
  4221.                    additional information necessary to restore this context
  4222.                    to its original state when the program invokes a Set
  4223.                    subfunction.
  4224.  
  4225.  
  4226.           REGISTERS MODIFIED
  4227.  
  4228.                AX
  4229.  
  4230.  
  4231.           STATUS
  4232.  
  4233.                AH = 0   SUCCESSFUL.
  4234.                    The manager has saved the partial map context.
  4235.  
  4236.                AH = 80h   NON-RECOVERABLE.
  4237.                    The manager detected a malfunction in the memory manager
  4238.                    software.
  4239.  
  4240.                AH = 81h   NON-RECOVERABLE.
  4241.                    The manager detected a malfunction in the expanded
  4242.                    memory hardware.
  4243.  
  4244.                AH = 84h   NON-RECOVERABLE.
  4245.                    The function code passed to the memory manager is not
  4246.                    defined.
  4247.  
  4248.  
  4249.           EMM Functions                                                  67
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.           Function 16. Get/Set Partial Page Map
  4256.           Get Partial Page Map subfunction
  4257.  
  4258.  
  4259.  
  4260.                AH = 8Bh   NON-RECOVERABLE.
  4261.                    One of the specified segments is not a mappable segment.
  4262.  
  4263.                AH = 8Fh   NON-RECOVERABLE.
  4264.                    The subfunction parameter is invalid.
  4265.  
  4266.                AH = A3h   NON-RECOVERABLE.
  4267.                    The contents of the partial page map structure have been
  4268.                    corrupted, or the pointer passed to the subfunction is
  4269.                    invalid.
  4270.  
  4271.  
  4272.           EXAMPLE
  4273.  
  4274.           partial_page_map               partial_page_map_struct <>
  4275.  
  4276.           dest_array                     DB ? DUP (?)
  4277.  
  4278.           MOV   AX,SEG partial_page_map
  4279.           MOV   DS,AX
  4280.           LEA   SI,partial_page_map      ; DS:SI points to partial_page_map
  4281.           MOV   AX,SEG dest_array
  4282.           MOV   ES,AX
  4283.           LEA   DI,dest_array            ; ES:DI points to dest_array
  4284.           MOV   AX,4F00h                 ; load function code
  4285.           INT   67h                      ; call the memory manager
  4286.           OR    AH,AH                    ; check EMM status
  4287.           JNZ   emm_err_handler          ; jump to error handler on error
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.  
  4307.  
  4308.           EMM Functions                                                  68
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314.           Function 16. Get/Set Partial Page Map
  4315.           Set Partial Page Map subfunction
  4316.  
  4317.  
  4318.  
  4319.           PURPOSE
  4320.  
  4321.                The Set Partial Page Map subfunction provides a mechanism
  4322.                for restoring the mapping context for a partial mapping
  4323.                context for specific mappable memory regions in a system. 
  4324.                Because this function restores only a subset of the entire
  4325.                mapping context and not the entire systems mapping context,
  4326.                it uses much less memory for the save area and is potential-
  4327.                ly faster than Function 15.  The subfunction does this by
  4328.                copying the contents of the source array to selected mapping
  4329.                registers on each expanded memory board.  The application
  4330.                passes a pointer to the source array.
  4331.  
  4332.                Use this function instead of Functions 8 and 9 if you need
  4333.                to save or restore the mapping context but don't want (or
  4334.                have) to use a handle.
  4335.  
  4336.  
  4337.           CALLING PARAMETERS
  4338.  
  4339.                AX = 4F01h
  4340.                    Contains the Set Partial Page Map subfunction
  4341.  
  4342.                            source_array     DB ? DUP (?)
  4343.  
  4344.                DS:SI = source_array
  4345.                    Contains a pointer to the source array in segment:offset
  4346.                    format.  The application must point to an array which
  4347.                    contains the partial mapping register state.  To deter-
  4348.                    mine the size of the required array, see the Get Size of
  4349.                    Partial Page Map Save Array subfunction.
  4350.  
  4351.  
  4352.           REGISTERS MODIFIED
  4353.  
  4354.                AX
  4355.  
  4356.  
  4357.           STATUS
  4358.  
  4359.                AH = 0   SUCCESSFUL.
  4360.                    The manager has restored the partial mapping context.
  4361.  
  4362.                AH = 80h   NON-RECOVERABLE.
  4363.                    The manager detected a malfunction in the memory manager
  4364.                    software.
  4365.  
  4366.  
  4367.           EMM Functions                                                  69
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.           Function 16. Get/Set Partial Page Map
  4374.           Set Partial Page Map subfunction
  4375.  
  4376.  
  4377.  
  4378.                AH = 81h   NON-RECOVERABLE.
  4379.                    The manager detected a malfunction in the expanded
  4380.                    memory hardware.
  4381.  
  4382.                AH = 84h   NON-RECOVERABLE.
  4383.                    The function code passed to the memory manager is not
  4384.                    defined.
  4385.  
  4386.                AH = 8Fh   NON-RECOVERABLE.
  4387.                    The subfunction parameter is invalid.
  4388.  
  4389.                AH = A3h   NON-RECOVERABLE.
  4390.                    The contents of the source array have been corrupted, or
  4391.                    the pointer passed to the subfunction is invalid.
  4392.  
  4393.  
  4394.           EXAMPLE
  4395.  
  4396.           MOV   AX,SEG source_array
  4397.           MOV   DS,AX
  4398.           LEA   SI,source_array          ; DS:SI points to source_array
  4399.           MOV   AX,4F01h                 ; load function code
  4400.           INT   67h                      ; call the memory manager
  4401.           OR    AH,AH                    ; check EMM status
  4402.           JNZ   emm_err_handler          ; jump to error handler on error
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.           EMM Functions                                                  70
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.           Function 16. Get/Set Partial Page Map
  4433.           Get Size of Partial Page Map Save Array subfunction
  4434.  
  4435.  
  4436.  
  4437.           PURPOSE
  4438.  
  4439.                The Get Size of Partial Page Map Save Array subfunction
  4440.                returns the storage requirements for the array passed by the
  4441.                other two subfunctions.  This subfunction doesn't require an
  4442.                EMM handle.
  4443.  
  4444.  
  4445.           CALLING PARAMETERS
  4446.  
  4447.                AX = 4F02h
  4448.                    Contains the Get Size of Partial Page Map Save Array
  4449.                    subfunction.  The size of this array depends on the
  4450.                    expanded memory system configuration and the implementa-
  4451.                    tion of the expanded memory manager.  Therefore, it will
  4452.                    vary between hardware configurations and implementations
  4453.                    and must be determined after a specific memory manager
  4454.                    is loaded.
  4455.  
  4456.                BX = number of pages in the partial array
  4457.                    Contains the number of pages in the partial map to be
  4458.                    saved by the Get/Set Partial Page Map subfunctions. 
  4459.                    This number should be the same as the mappable_seg-
  4460.                    ment_count in the Get Partial Page Map subfunction.
  4461.  
  4462.  
  4463.           RESULTS
  4464.  
  4465.                These results are valid only if the status returned is zero.
  4466.  
  4467.                AL = size_of_partial_save_array
  4468.                    Contains the number of bytes that will be transferred to
  4469.                    the memory areas supplied by an application whenever a
  4470.                    program requests the Get or Set subfunction.
  4471.  
  4472.  
  4473.           REGISTERS MODIFIED
  4474.  
  4475.                AX
  4476.  
  4477.  
  4478.           STATUS
  4479.  
  4480.                AH = 0   SUCCESSFUL.
  4481.                    The manager has returned the array size.
  4482.  
  4483.  
  4484.  
  4485.           EMM Functions                                                  71
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.           Function 16. Get/Set Partial Page Map
  4492.           Get Size of Partial Page Map Save Array subfunction
  4493.  
  4494.  
  4495.  
  4496.                AH = 80h   NON-RECOVERABLE.
  4497.                    The manager detected a malfunction in the memory manager
  4498.                    software.
  4499.  
  4500.                AH = 81h   NON-RECOVERABLE.
  4501.                    The manager detected a malfunction in the expanded
  4502.                    memory hardware.
  4503.  
  4504.                AH = 84h   NON-RECOVERABLE.
  4505.                    The function code passed to the memory manager is not
  4506.                    defined.
  4507.  
  4508.                AH = 8Bh   NON-RECOVERABLE.
  4509.                    The number of physical pages is outside the range of
  4510.                    physical pages in the system.
  4511.  
  4512.                AH = 8Fh   NON-RECOVERABLE.
  4513.                    The subfunction parameter is invalid.
  4514.  
  4515.  
  4516.           EXAMPLE
  4517.  
  4518.           number_of_pages_to_map              DW ?
  4519.           size_of_partial_save_array          DB ?
  4520.  
  4521.           MOV   BX,number_of_pages_to_map
  4522.           MOV   AX,4F02h                      ; load function code
  4523.           INT   67h                           ; call the memory manager
  4524.           OR    AH,AH                         ; check EMM status
  4525.           JNZ   emm_err_handler               ; jump to error handler on   
  4526.                                               ; error
  4527.           MOV   size_of_partial_save_array,AL ; save array size
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.           EMM Functions                                                  72
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.           Function 17. Map/Unmap Multiple Handle Pages
  4551.  
  4552.  
  4553.  
  4554.           PURPOSE
  4555.  
  4556.                This function can, in a single invocation, map (or unmap)
  4557.                logical pages into as many physical pages as the system
  4558.                supports.  Consequently, it has less execution overhead than
  4559.                mapping pages one at a time.  For applications which do a
  4560.                lot of page mapping, this is the preferred mapping method.
  4561.  
  4562.  
  4563.           Mapping Multiple Pages
  4564.  
  4565.                The handle passed to this function determines what type of
  4566.                logical pages are being mapped.  Logical pages that Function
  4567.                4 allocates are referred to as pages and are 16K bytes. 
  4568.                Logical pages that Function 27 allocates are referred to as
  4569.                raw pages and might not be the same size as the pages
  4570.                Function 4 allocates.
  4571.  
  4572.  
  4573.           Unmapping Multiple Pages
  4574.  
  4575.                This function can make specific physical pages unavailable
  4576.                for reading or writing.  A logical page which is unmapped
  4577.                from a specific physical page cannot be read or written from
  4578.                that physical page.  The logical page which is unavailable
  4579.                (unmapped) can be made available again my mapping it, or a
  4580.                new logical page, at the physical page that was unmapped. 
  4581.                Unmapping a physical page is accomplished by setting the
  4582.                logical page it is associated with to FFFFh.
  4583.  
  4584.                You might unmap an entire set of mapped pages, for example,
  4585.                before loading and executing a program.  This ensures that
  4586.                the loaded program won't be able to access the pages your
  4587.                program has mapped.  However, you must save the mapping
  4588.                context before you unmap the physical pages.  This enables
  4589.                you to restore it later so that you may access the memory
  4590.                you had mapped there.  You can save the mapping context with
  4591.                Functions 8, 15, or 16.  You can restore the mapping context
  4592.                with Functions 9, 15, or 16.
  4593.  
  4594.  
  4595.           Mapping and Unmapping Multiple Pages Simultaneously
  4596.  
  4597.                Both mapping and unmapping pages can be done in the same
  4598.                invocation.
  4599.  
  4600.  
  4601.  
  4602.  
  4603.           EMM Functions                                                  73
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.           Function 17. Map/Unmap Multiple Handle Pages
  4610.  
  4611.  
  4612.  
  4613.                Mapping or unmapping no pages is not considered an error. 
  4614.                If a request to map or unmap zero pages is made, nothing is
  4615.                done and no error is returned.
  4616.  
  4617.  
  4618.           Alternate Mapping and Unmapping Methods
  4619.  
  4620.                You can map or unmap pages using two methods.  Both methods
  4621.                produce identical results.
  4622.  
  4623.                1.  The first method specifies both a logical page and a
  4624.                    physical page at which the logical page is to be mapped. 
  4625.                    This method is an extension of Function 5 (Map Handle
  4626.                    Page).
  4627.  
  4628.                2.  The second method specifies both a logical page and a
  4629.                    corresponding segment address at which the logical page
  4630.                    is to be mapped.  While this is functionally the same as
  4631.                    the first method, it may be easier to use the actual
  4632.                    segment address of a physical page than to use a number
  4633.                    which only represents its location.  The memory manager
  4634.                    verifies whether the specified segment address falls on
  4635.                    the boundary of a mappable physical page.  The manager
  4636.                    then translates the segment address passed to it into
  4637.                    the necessary internal representation to map the pages.
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.           EMM Functions                                                  74
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.           Function 17. Map/Unmap Multiple Handle Pages
  4669.           Logical Page/Physical Page Method
  4670.  
  4671.  
  4672.           CALLING PARAMETERS
  4673.  
  4674.                AX = 5000h
  4675.                    Contains the Map/Unmap Multiple Handle Pages subfunction
  4676.                    using the logical page/physical page method.
  4677.  
  4678.                    log_to_phys_map_struct          STRUC
  4679.                        log_page_number             DW ?
  4680.                        phys_page_number            DW ?
  4681.                    log_to_phys_map_struct          ENDS
  4682.  
  4683.                DX = handle
  4684.                    Contains the EMM handle.
  4685.  
  4686.                CX = log_to_phys_map_len
  4687.                    Contains the number of entries in the array.  For
  4688.                    example, if the array contained four pages to map or
  4689.                    unmap, then CX would contain 4.
  4690.  
  4691.                DS:SI = pointer to log_to_phys_map array
  4692.                    Contains a pointer to an array of structures that
  4693.                    contains the information necessary to map the desired
  4694.                    pages.  The array is made up of the following two
  4695.                    elements:
  4696.  
  4697.                    .log_page_number
  4698.                        The first member is a word which contains the number
  4699.                        of the logical page which is to be mapped.  Logical
  4700.                        pages are numbered zero-relative, so the number for
  4701.                        a logical page can only range from zero to (maximum
  4702.                        number of logical pages allocated to the handle -
  4703.                        1).
  4704.  
  4705.                        If the logical page number is set to FFFFh, the
  4706.                        physical page associated with it is unmapped rather
  4707.                        than mapped.  Unmapping a physical page makes it
  4708.                        inaccessible for reading or writing.
  4709.  
  4710.                    .phys_page_number
  4711.                        The second member is a word which contains the
  4712.                        number of the physical page at which the logical
  4713.                        page is to be mapped.  Physical pages are numbered
  4714.                        zero-relative, so the number for a physical page can
  4715.                        only range from zero to (maximum number of physical
  4716.                        pages supported in the system - 1).
  4717.  
  4718.  
  4719.  
  4720.  
  4721.           EMM Functions                                                  75
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.           Function 17. Map/Unmap Multiple Handle Pages
  4728.           Logical Page/Physical Page Method
  4729.  
  4730.  
  4731.  
  4732.           REGISTERS MODIFIED
  4733.  
  4734.                AX
  4735.  
  4736.  
  4737.           STATUS
  4738.  
  4739.                AH = 0   SUCCESSFUL.
  4740.                    The logical pages have been mapped, or unmapped, at the
  4741.                    specified physical pages.
  4742.  
  4743.                AH = 80h   NON-RECOVERABLE.
  4744.                    The manager detected a malfunction in the memory manager
  4745.                    software.
  4746.  
  4747.                AH = 81h   NON-RECOVERABLE.
  4748.                    The manager detected a malfunction in the expanded
  4749.                    memory hardware.
  4750.  
  4751.                AH = 83h   NON-RECOVERABLE.
  4752.                    The manager couldn't find the specified EMM handle.  The
  4753.                    manager doesn't currently have any information pertain-
  4754.                    ing to the specified EMM handle.  The program has
  4755.                    probably corrupted its EMM handle.
  4756.  
  4757.                AH = 84h   NON-RECOVERABLE.
  4758.                    The function code passed to the memory manager is not
  4759.                    defined.
  4760.  
  4761.                AH = 8Ah   RECOVERABLE.
  4762.                    One or more of the mapped logical pages is out of the
  4763.                    range of logical pages allocated to the EMM handle.  The
  4764.                    program can recover by attempting to map a logical page
  4765.                    which is within the bounds for the specified EMM handle. 
  4766.                    When this error occurs, the only pages mapped were the
  4767.                    ones valid up to the point that the error occurred.
  4768.  
  4769.                AH = 8Bh   RECOVERABLE.
  4770.                    One or more of the physical pages is out of the range of
  4771.                    mappable physical pages.  The program can recover from
  4772.                    this condition by attempting to map into memory at the
  4773.                    physical page which is in the range of the physical page
  4774.                    numbers supported by the system.  When this error
  4775.                    occurs, the only pages mapped were the ones valid up to
  4776.                    the point that the error occurred.
  4777.  
  4778.  
  4779.  
  4780.           EMM Functions                                                  76
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.           Function 17. Map/Unmap Multiple Handle Pages
  4787.           Logical Page/Physical Page Method
  4788.  
  4789.  
  4790.  
  4791.                AH = 8Fh   NON-RECOVERABLE.
  4792.                    The subfunction parameter is invalid.
  4793.  
  4794.  
  4795.           EXAMPLE
  4796.  
  4797.           log_to_phys_map            log_to_phys_map_struct ? DUP (?)
  4798.  
  4799.           emm_handle                 DW ?
  4800.  
  4801.           MOV   AX,SEG log_to_phys_map
  4802.           MOV   DS,AX
  4803.           LEA   SI,log_to_phys_map            ; DS:SI points to
  4804.                                               ; log_to_phys_map
  4805.           MOV   CX,LENGTH log_to_phys_map     ; set length field
  4806.           MOV   DX,emm_handle
  4807.           MOV   AX,5000h                      ; load function code
  4808.           INT   67h                           ; call the memory manager
  4809.           OR    AH,AH                         ; check EMM status
  4810.           JNZ   emm_err_handler               ; jump to error handler on   
  4811.                                               ; error
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.           EMM Functions                                                  77
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.           Function 17. Map/Unmap Multiple Handle Pages
  4846.           Logical Page/Segment Address Method
  4847.  
  4848.  
  4849.           CALLING PARAMETERS
  4850.  
  4851.                AX = 5001h
  4852.                    Contains the Map/Unmap Multiple Handle Pages subfunction
  4853.                    using the logical page/segment address method.
  4854.  
  4855.                    log_to_seg_map_struct           STRUC
  4856.                        log_page_number             DW ?
  4857.                        mappable_segment_address    DW ?
  4858.                    log_to_seg_map_struct           ENDS
  4859.  
  4860.                DX = handle
  4861.                    Contains the EMM handle.
  4862.  
  4863.                CX = log_to_segment_map_len
  4864.                    Contains the number of entries in the array.  For
  4865.                    example, if the array contained four pages to map or
  4866.                    unmap, then CX would contain four.
  4867.  
  4868.                DS:SI = pointer to log_to_segment_map array
  4869.                    Contains a pointer to an array of structures that
  4870.                    contains the information necessary to map the desired
  4871.                    pages.  The array is made up of the following elements:
  4872.  
  4873.                    .log_page_number
  4874.                        The first member is a word which contains the number
  4875.                        of the logical pages to be mapped.  Logical pages
  4876.                        are numbered zero-relative, so the number for a
  4877.                        logical page can range from zero to (maximum number
  4878.                        of logical pages allocated to the handle - 1).
  4879.  
  4880.                        If the logical page number is set to FFFFh, the
  4881.                        physical page associated with it is unmapped rather
  4882.                        than mapped.  Unmapping a physical page makes it
  4883.                        inaccessible for reading or writing.
  4884.  
  4885.                    .mappable_segment_address
  4886.                        The second member is a word which contains the
  4887.                        segment address at which the logical page is to be
  4888.                        mapped.  This segment address must correspond
  4889.                        exactly to a mappable segment address.  The mappable
  4890.                        segment addresses are available with Function 25
  4891.                        (Get Mappable Physical Address Array).
  4892.  
  4893.  
  4894.           REGISTERS MODIFIED
  4895.  
  4896.                AX
  4897.  
  4898.           EMM Functions                                                  78
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.           Function 17. Map/Unmap Multiple Handle Pages
  4905.           Logical Page/Segment Address Method
  4906.  
  4907.  
  4908.  
  4909.           STATUS
  4910.  
  4911.                AH = 0   SUCCESSFUL.
  4912.                    The logical pages have been mapped (or unmapped) at the
  4913.                    specified physical pages.
  4914.  
  4915.                AH = 80h   NON-RECOVERABLE.
  4916.                    The manager detected a malfunction in the memory manager
  4917.                    software.
  4918.  
  4919.                AH = 81h   NON-RECOVERABLE.
  4920.                    The manager detected a malfunction in the expanded
  4921.                    memory hardware.
  4922.  
  4923.                AH = 83h   NON-RECOVERABLE.
  4924.                    The manager couldn't find the specified EMM handle.  The
  4925.                    manager doesn't currently have any information pertain-
  4926.                    ing to the specified EMM handle.  The program has
  4927.                    probably corrupted its EMM handle.
  4928.  
  4929.                AH = 84h   NON-RECOVERABLE.
  4930.                    The function code passed to the memory manager is not
  4931.                    defined.
  4932.  
  4933.                AH = 8Ah   RECOVERABLE.
  4934.                    One or more of the logical pages to be mapped is out of
  4935.                    the range of logical pages allocated to the EMM handle. 
  4936.                    The program can recover from this condition by mapping a
  4937.                    logical page which is within the bounds for the speci-
  4938.                    fied EMM handle.  When this error occurs, the only pages
  4939.                    mapped or unmapped were the ones valid up to the point
  4940.                    that the error occurred.
  4941.  
  4942.                AH = 8Bh   RECOVERABLE.
  4943.                    One or more of the mappable segment addresses specified
  4944.                    is not mappable, or the segment address doesn't fall
  4945.                    exactly on a mappable address boundary.  The program can
  4946.                    recover from this condition by mapping into memory on an
  4947.                    exact mappable segment address.  When this error occurs,
  4948.                    the only pages mapped were the ones valid up to the
  4949.                    point that the error occurred.
  4950.  
  4951.                AH = 8Fh   NON-RECOVERABLE.
  4952.                    The subfunction parameter is invalid.
  4953.  
  4954.  
  4955.  
  4956.  
  4957.           EMM Functions                                                  79
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.           Function 17. Map/Unmap Multiple Handle Pages
  4964.           Logical Page/Segment Address Method
  4965.  
  4966.  
  4967.  
  4968.           EXAMPLE
  4969.  
  4970.           log_to_seg_map             log_to_seg_map_struct 4 DUP (?)
  4971.  
  4972.           emm_handle                 DW ?
  4973.  
  4974.           MOV   AX,SEG log_to_seg_map
  4975.           MOV   DS,AX
  4976.           LEA   SI,log_to_seg_map             ; DS:SI points to
  4977.                                               ; log_to_seg_map
  4978.           MOV   CX,LENGTH log_to_seg_map
  4979.           MOV   DX,emm_handle
  4980.           MOV   AX,5001h                      ; load function code
  4981.           INT   67h                           ; call the memory manager
  4982.           OR    AH,AH                         ; check EMM status
  4983.           JNZ   emm_err_handler               ; jump to error handler on   
  4984.                                               ; error
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.           EMM Functions                                                  80
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.           Function 18. Reallocate Pages
  5023.  
  5024.  
  5025.  
  5026.           PURPOSE
  5027.  
  5028.                This function allows an application program to increase or
  5029.                decrease (reallocate) the number of logical pages allocated
  5030.                to an EMM handle.  There are four reallocation cases of
  5031.                interest:
  5032.  
  5033.                1.  A reallocation count of zero.  The handle assigned to
  5034.                    the application remains assigned and is still available
  5035.                    for use by the application.  The memory manager won't
  5036.                    reassign the handle to any other application.  However,
  5037.                    the handle will have any currently allocated pages
  5038.                    returned to the memory manager.  The application must
  5039.                    invoke the Deallocate Pages function (Function 6) before
  5040.                    returning to DOS, or the handle will remain assigned and
  5041.                    no other application will be able to use it.
  5042.  
  5043.                2.  A reallocation count equal to the current allocation
  5044.                    count.  This is not treated as an error, and a success-
  5045.                    ful status is returned.
  5046.  
  5047.                3.  A reallocation count greater than the current allocation
  5048.                    count.  The memory manager will attempt to add new pages
  5049.                    to those pages already allocated to the specified EMM
  5050.                    handle.  The number of new pages added is the difference
  5051.                    between the reallocation count and the current alloca-
  5052.                    tion count.  The sequence of logical pages allocated to
  5053.                    the EMM handle remains continuous after this operation. 
  5054.                    The newly allocated pages have logical page numbers
  5055.                    which begin where the previously allocated pages ended,
  5056.                    and continue in ascending sequence.
  5057.  
  5058.                4.  A reallocation count less than the current allocation
  5059.                    count.  The memory manager will attempt to subtract some
  5060.                    of the currently allocated pages and return them to the
  5061.                    memory manager.  The number of old pages subtracted is
  5062.                    the difference between the current allocation count and
  5063.                    the re-allocation count.  The pages are subtracted from
  5064.                    the end of the sequence of pages currently allocated to
  5065.                    the specified EMM handle.  The sequence of logical pages
  5066.                    allocated to the EMM handle remains continuous after
  5067.                    this operation.
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.           EMM Functions                                                  81
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.           Function 18. Reallocate Pages
  5082.  
  5083.  
  5084.  
  5085.           The handle determines what type of logical pages are being
  5086.           reallocated.  Logical pages which were originally allocated with
  5087.           Function 4 are called pages and are 16K bytes long.  Logical
  5088.           pages which were allocated with Function 27 are called raw pages
  5089.           and might not be the same size as pages allocated with Function
  5090.           4.
  5091.  
  5092.  
  5093.           CALLING PARAMETERS
  5094.  
  5095.                AH = 51h
  5096.                    Contains the Reallocate Handle Pages function.
  5097.  
  5098.                DX = handle
  5099.                    Contains the EMM handle.
  5100.  
  5101.                BX = reallocation_count
  5102.                    Contains the total number of pages this handle should
  5103.                    have allocated to it after this function is invoked.
  5104.  
  5105.  
  5106.           RESULTS
  5107.  
  5108.                BX = number of pages allocated to handle after reallocation
  5109.                    Contains the number of pages now allocated to the EMM
  5110.                    handle after the pages have been added or subtracted. 
  5111.                    If the status returned is not zero, the value in BX is
  5112.                    equal to the number of pages allocated to the handle
  5113.                    prior to the invocation of this function.  This informa-
  5114.                    tion can be used to verify that the request generated
  5115.                    the expected results.
  5116.  
  5117.  
  5118.           REGISTERS MODIFIED
  5119.  
  5120.                AX, BX
  5121.  
  5122.  
  5123.           STATUS
  5124.  
  5125.                AH = 0   SUCCESSFUL.
  5126.                    The pages specified have been added to or subtracted
  5127.                    from the handle specified.
  5128.  
  5129.                AH = 80h   NON-RECOVERABLE.
  5130.                    The manager detected a malfunction in the memory manager
  5131.                    software.
  5132.  
  5133.  
  5134.           EMM Functions                                                  82
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.           Function 18. Reallocate Pages
  5141.  
  5142.  
  5143.  
  5144.                AH = 81h   NON-RECOVERABLE.
  5145.                    The manager detected a malfunction in the expanded
  5146.                    memory hardware.
  5147.  
  5148.                AH = 83h   NON-RECOVERABLE.
  5149.                    The manager could not find the specified EMM handle. 
  5150.                    The manager doesn't have any information pertaining to
  5151.                    the specified EMM handle.  The program may have cor-
  5152.                    rupted its EMM handle.
  5153.  
  5154.                AH = 84h   NON-RECOVERABLE.
  5155.                    The function code passed to the memory manager is not
  5156.                    defined.
  5157.  
  5158.                AH = 87h   RECOVERABLE.
  5159.                    The number of pages that are available in the system is
  5160.                    insufficient for the new allocation request.  The
  5161.                    program can recover from this condition by specifying
  5162.                    fewer pages be allocated to the EMM handle.
  5163.  
  5164.                AH = 88h   RECOVERABLE.
  5165.                    The number of unallocated pages is insufficient for the
  5166.                    new allocation request.  The program can recover from
  5167.                    this condition by either requesting again when addition-
  5168.                    al pages are available or specifying fewer pages.
  5169.  
  5170.  
  5171.           EXAMPLE
  5172.  
  5173.           emm_handle                          DW ?
  5174.           realloc_count                       DW ?
  5175.           current_alloc_page_count            DW ?
  5176.  
  5177.           MOV   DX,emm_handle                 ; specify EMM handle
  5178.           MOV   BX,realloc_count              ; specify count
  5179.           MOV   AH,51h                        ; load function code
  5180.           INT   67h                           ; call the memory manager
  5181.           OR    AH,AH                         ; check EMM status
  5182.           JNZ   emm_err_handler               ; jump to error handler on   
  5183.                                               ; error
  5184.           MOV   current_alloc_page_count,BX
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.           EMM Functions                                                  83
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.           Function 19. Get/Set Handle Attribute
  5200.  
  5201.  
  5202.  
  5203.           Design Considerations
  5204.  
  5205.                This function is an option which will probably not be
  5206.                available in a typical expanded memory manager, system, or
  5207.                memory board.  Most personal computer systems disable memory
  5208.                refresh signals for a considerable period during a warm
  5209.                boot.  This can corrupt some of the data in memory boards,
  5210.                even though there is no problem with the design of the
  5211.                memory board, its operation, or the memory chips.  This
  5212.                memory refresh deficiency is present in the software design
  5213.                of the ROM BIOS in most personal computer systems.
  5214.  
  5215.                The majority of memory board designs, chip types, or
  5216.                personal computer systems won't be able to support the non-
  5217.                volatility feature.  The reason that this ROM BIOS deficien-
  5218.                cy is not evident in the conventional or extended memory
  5219.                area is that the ROM BIOS always initializes this area
  5220.                during a warm boot.  Memory data integrity is not a problem
  5221.                with the conventional or extended memory region, because it
  5222.                isn't physically possible to have data retained there across
  5223.                a warm boot event -- the ROM BIOS sets it to zero.
  5224.  
  5225.                Consequently, expanded memory board manufacturers should not
  5226.                supply this function unless their board can guarantee the
  5227.                integrity of data stored in the board's memory during a warm
  5228.                boot.  Generally, this means the memory board has an
  5229.                independent memory refresh controller which does not depend
  5230.                on the system board's memory refresh.
  5231.  
  5232.                If the expanded memory manager, system, or memory board
  5233.                cannot support this feature, it should return the not
  5234.                supported status described in the function.
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.           EMM Functions                                                  84
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.           Function 19. Get/Set Handle Attribute
  5259.           Get Handle Attribute subfunction
  5260.  
  5261.  
  5262.  
  5263.           PURPOSE
  5264.  
  5265.                This subfunction returns the attribute associated with a
  5266.                handle.  The attributes are volatile or non-volatile. 
  5267.                Handles with non-volatile attributes enable the memory
  5268.                manager to save the contents of a handle's pages between
  5269.                warm boots.  However, this function may be disabled with a
  5270.                user option or may not be supported by the memory board or
  5271.                system hardware.
  5272.  
  5273.                If the handle's attribute has been set to non-volatile, the
  5274.                handle, its name (if it is assigned one), and the contents
  5275.                of the pages allocated to the handle are all maintained
  5276.                after a warm boot.
  5277.  
  5278.  
  5279.           CALLING PARAMETERS
  5280.  
  5281.                AX = 5200h
  5282.                    Contains the Get Handle Attribute subfunction.
  5283.  
  5284.                DX = handle
  5285.                    Contains the EMM handle.
  5286.  
  5287.  
  5288.           RESULTS
  5289.  
  5290.                These results are valid only if the status returned is zero.
  5291.  
  5292.                AL = handle attribute
  5293.                    Contains the EMM handle's attribute.  The only at-
  5294.                    tributes a handle may have are volatile or non-volatile. 
  5295.                    A value of zero indicates the handle is volatile.  A
  5296.                    value of one indicates that the handle is non-volatile.
  5297.  
  5298.  
  5299.           REGISTERS MODIFIED
  5300.  
  5301.                AX
  5302.  
  5303.  
  5304.           STATUS
  5305.  
  5306.                AH = 0   SUCCESSFUL.
  5307.                    The handle's attribute has been obtained.
  5308.  
  5309.  
  5310.  
  5311.           EMM Functions                                                  85
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.           Function 19. Get/Set Handle Attribute
  5318.           Get Handle Attribute subfunction
  5319.  
  5320.  
  5321.  
  5322.                AH = 80h   NON-RECOVERABLE.
  5323.                    The manager detected a malfunction in the memory manager
  5324.                    software.
  5325.  
  5326.                AH = 81h   NON-RECOVERABLE.
  5327.                    The manager detected a malfunction in the expanded
  5328.                    memory hardware.
  5329.  
  5330.                AH = 83h   NON-RECOVERABLE.
  5331.                    The manager could not find the specified EMM handle. 
  5332.                    The manager doesn't have any information pertaining to
  5333.                    the specified EMM handle.  The program may have cor-
  5334.                    rupted its EMM handle.
  5335.  
  5336.                AH = 84h   NON-RECOVERABLE.
  5337.                    The function code passed to the memory manager is not
  5338.                    defined.
  5339.  
  5340.                AH = 8Fh   NON-RECOVERABLE.
  5341.                    The subfunction parameter is invalid.
  5342.  
  5343.                AH = 91h   NON-RECOVERABLE.
  5344.                    This feature is not supported.
  5345.  
  5346.  
  5347.           EXAMPLE
  5348.  
  5349.           emm_handle                     DW ?
  5350.           handle_attrib                  DB ?
  5351.  
  5352.           MOV   DX,emm_handle            ; specify EMM handle
  5353.           MOV   AX,5200h                 ; load function code
  5354.           INT   67h                      ; call the memory manager
  5355.           OR    AH,AH                    ; check EMM status
  5356.           JNZ   emm_err_handler          ; jump to error handler on error
  5357.           MOV   handle_attrib,AL         ; save handle attribute
  5358.  
  5359.  
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.           EMM Functions                                                  86
  5371.  
  5372.  
  5373.  
  5374.  
  5375.  
  5376.           Function 19. Get/Set Handle Attribute
  5377.           Set Handle Attribute subfunction
  5378.  
  5379.  
  5380.  
  5381.           PURPOSE
  5382.  
  5383.                This subfunction can be used to modify the attribute which a
  5384.                handle has associated with it.  The attributes which a
  5385.                handle may have are volatile or non-volatile.  The non-
  5386.                volatile attribute enables the EMM to save the contents of a
  5387.                handle's pages between warm boots.  However, this function
  5388.                may be disabled with a user option or may not be supported
  5389.                by the memory board or system hardware.
  5390.  
  5391.                If the handle's attribute has been set to non-volatile, the
  5392.                handle, its name (if it is assigned one), and the contents
  5393.                of the pages allocated to the handle are all maintained
  5394.                after a warm boot.
  5395.  
  5396.  
  5397.           CALLING PARAMETERS
  5398.  
  5399.                AX = 5201h
  5400.                    Contains the Set Handle Attribute function.
  5401.  
  5402.                DX = handle
  5403.                    Contains the EMM handle.
  5404.  
  5405.                BL = new handle attribute
  5406.                    Contains the handle's new attribute.  A value of zero
  5407.                    indicates that the handle should be made volatile.  A
  5408.                    value of one indicates that the handle should be made
  5409.                    non-volatile.
  5410.  
  5411.                    A volatile handle attribute instructs the memory manager
  5412.                    to deallocate both the handle and the pages allocated to
  5413.                    it after a warm boot.  If all handles have the volatile
  5414.                    attribute (the default attribute) at warm boot, the
  5415.                    handle directory will be empty and all of expanded
  5416.                    memory will be initialized to zero immediately after a
  5417.                    warm boot.
  5418.  
  5419.  
  5420.           REGISTERS MODIFIED
  5421.  
  5422.                AX
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.           EMM Functions                                                  87
  5430.  
  5431.  
  5432.  
  5433.  
  5434.  
  5435.           Function 19. Get/Set Handle Attribute
  5436.           Set Handle Attribute subfunction
  5437.  
  5438.  
  5439.  
  5440.           STATUS
  5441.  
  5442.                AH = 0   SUCCESSFUL.
  5443.                    The handle's attribute has been modified.
  5444.  
  5445.                AH = 80h   NON-RECOVERABLE.
  5446.                    The manager detected a malfunction in the memory manager
  5447.                    software.
  5448.  
  5449.                AH = 81h   NON-RECOVERABLE.
  5450.                    The manager detected a malfunction in the expanded
  5451.                    memory hardware.
  5452.  
  5453.                AH = 83h   NON-RECOVERABLE.
  5454.                    The manager could not find the specified EMM handle. 
  5455.                    The manager doesn't have any information pertaining to
  5456.                    the specified EMM handle.  The program may have cor-
  5457.                    rupted its EMM handle.
  5458.  
  5459.                AH = 84h   NON-RECOVERABLE.
  5460.                    The function code passed to the memory manager is not
  5461.                    defined.
  5462.  
  5463.                AH = 8Fh   NON-RECOVERABLE.
  5464.                    The subfunction parameter is invalid.
  5465.  
  5466.                AH = 90h   NON-RECOVERABLE.
  5467.                    The attribute type is undefined.
  5468.  
  5469.                AH = 91h   NON-RECOVERABLE.
  5470.                    This feature is not supported.
  5471.  
  5472.  
  5473.           EXAMPLE
  5474.  
  5475.           emm_handle                     DW ?
  5476.           new_handle_attrib              DB ?
  5477.  
  5478.           MOV   DX,emm_handle            ; specify EMM handle
  5479.           MOV   BL,new_handle_attrib     ; specify the set attribute
  5480.           MOV   AX,5201h                 ; load function code
  5481.           INT   67h                      ; call the memory manager
  5482.           OR    AH,AH                    ; check EMM status
  5483.           JNZ   emm_err_handler          ; jump to error handler on error
  5484.  
  5485.  
  5486.  
  5487.  
  5488.           EMM Functions                                                  88
  5489.  
  5490.  
  5491.  
  5492.  
  5493.  
  5494.           Function 19. Get/Set Handle Attribute
  5495.           Get Attribute Capability subfunction
  5496.  
  5497.  
  5498.  
  5499.           PURPOSE
  5500.  
  5501.                This subfunction can be used to determine whether the memory
  5502.                manager can support the non-volatile attribute.
  5503.  
  5504.  
  5505.           CALLING PARAMETERS
  5506.  
  5507.                AX = 5202h
  5508.                    Contains the Get Attribute Capability subfunction
  5509.  
  5510.  
  5511.           RESULTS
  5512.  
  5513.                These results are valid only if the status returned is zero.
  5514.  
  5515.                AL = attribute capability
  5516.                    Contains the attribute capability.  A value of zero
  5517.                    indicates that the memory manager and hardware supports
  5518.                    only volatile handles.  A value of one indicates that
  5519.                    the memory manager/hardware supports both volatile and
  5520.                    non-volatile handles.
  5521.  
  5522.  
  5523.           REGISTERS MODIFIED
  5524.  
  5525.                AX
  5526.  
  5527.  
  5528.           STATUS
  5529.  
  5530.                AH = 0   SUCCESSFUL.
  5531.                    The attribute capability has been returned.
  5532.  
  5533.                AH = 80h   NON-RECOVERABLE.
  5534.                    The manager detected a malfunction in the memory manager
  5535.                    software.
  5536.  
  5537.                AH = 81h   NON-RECOVERABLE.
  5538.                    The manager detected a malfunction in the expanded
  5539.                    memory hardware.
  5540.  
  5541.                AH = 84h   NON-RECOVERABLE.
  5542.                    The function code passed to the memory manager is not
  5543.                    defined.
  5544.  
  5545.  
  5546.  
  5547.           EMM Functions                                                  89
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.           Function 19. Get/Set Handle Attribute
  5554.           Get Attribute Capability subfunction
  5555.  
  5556.  
  5557.  
  5558.                AH = 8Fh   NON-RECOVERABLE.
  5559.                    The subfunction parameter is invalid.
  5560.  
  5561.  
  5562.           EXAMPLE
  5563.  
  5564.           attrib_capability              DB ?
  5565.  
  5566.           MOV   AX,5202h                 ; load function code
  5567.           INT   67h                      ; call the memory manager
  5568.           OR    AH,AH                    ; check EMM status
  5569.           JNZ   emm_err_handler          ; jump to error handler on error
  5570.           MOV   attrib_capability,AL     ; save attribute capability
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.           EMM Functions                                                  90
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.           Function 20. Get/Set Handle Name
  5613.           Get Handle Name subfunction
  5614.  
  5615.  
  5616.  
  5617.           PURPOSE
  5618.  
  5619.                This subfunction gets the eight character name currently
  5620.                assigned to a handle.  There is no restriction on the
  5621.                characters which may be used in the handle name (that is,
  5622.                anything from 00h through FFh).
  5623.  
  5624.                The handle name is initialized to ASCII nulls (binary zeros)
  5625.                three times:  when the memory manager is installed, when a
  5626.                handle is allocated, and when a handle is deallocated.  A
  5627.                handle with a name which is all ASCII nulls, by definition,
  5628.                has no name.  When a handle is assigned a name, at least one
  5629.                character in the name must be a non-null character in order
  5630.                to distinguish it from a handle without a name.
  5631.  
  5632.  
  5633.           CALLING PARAMETERS
  5634.  
  5635.                AX = 5300h
  5636.                    Contains the Get Handle Name function.
  5637.  
  5638.                DX = handle number
  5639.                    Contains the EMM handle.
  5640.  
  5641.                ES:DI = pointer to handle_name array
  5642.                    Contains a pointer to an eight-byte array into which the
  5643.                    name currently assigned to the handle will be copied.
  5644.  
  5645.  
  5646.           RESULTS
  5647.  
  5648.                These results are valid only if the status returned is zero.
  5649.  
  5650.                handle_name array
  5651.                    Contains the name associated with the specified handle.
  5652.  
  5653.  
  5654.           REGISTERS MODIFIED
  5655.  
  5656.                AX
  5657.  
  5658.  
  5659.           STATUS
  5660.  
  5661.                AH = 0   SUCCESSFUL.
  5662.                    The handle name has been returned.
  5663.  
  5664.  
  5665.           EMM Functions                                                  91
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.           Function 20. Get/Set Handle Name
  5672.           Get Handle Name subfunction
  5673.  
  5674.  
  5675.  
  5676.                AH = 80h   NON-RECOVERABLE.
  5677.                    The manager detected a malfunction in the memory manager
  5678.                    software.
  5679.  
  5680.                AH = 81h   NON-RECOVERABLE.
  5681.                    The manager detected a malfunction in the expanded
  5682.                    memory hardware.
  5683.  
  5684.                AH = 83h   NON-RECOVERABLE.
  5685.                    The manager could not find the specified EMM handle. 
  5686.                    The manager doesn't have any information pertaining to
  5687.                    the specified EMM handle.  The program may have cor-
  5688.                    rupted its EMM handle.
  5689.  
  5690.                AH = 84h   NON-RECOVERABLE.
  5691.                    The function code passed to the memory manager is not
  5692.                    defined.
  5693.  
  5694.                AH = 8Fh   NON-RECOVERABLE.
  5695.                    The subfunction parameter is invalid.
  5696.  
  5697.  
  5698.           EXAMPLE
  5699.  
  5700.           handle_name                    DB 8 DUP (?)
  5701.           emm_handle                     DW ?
  5702.  
  5703.           MOV   AX,SEG handle_name
  5704.           MOV   ES,AX
  5705.           LEA   DI,handle_name           ; ES:DI points to handle_name
  5706.           MOV   DX,emm_handle            ; specify EMM handle
  5707.           MOV   AX,5300h                 ; load function code
  5708.           INT   67h                      ; call the memory manager
  5709.           OR    AH,AH                    ; check EMM status
  5710.           JNZ   emm_err_handler          ; jump to error handler on error
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.           EMM Functions                                                  92
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.           Function 20. Get/Set Handle Name
  5731.           Set Handle Name subfunction
  5732.  
  5733.  
  5734.  
  5735.           PURPOSE
  5736.  
  5737.                This subfunction assigns an eight character name to a
  5738.                handle.  There is no restriction on the characters which may
  5739.                be used in the handle name.  The full range of values may be
  5740.                assigned to each character in a name (that is, 00h through
  5741.                FFh).
  5742.  
  5743.                At installation, all handles have their name initialized to
  5744.                ASCII nulls (binary zeros).  A handle with a name consisting
  5745.                of all ASCII nulls has no name.  When a handle is assigned a
  5746.                name, at least one character in the name must be a non-null
  5747.                character in order to distinguish it from a handle without a
  5748.                name.  No two handles may have the same name.
  5749.  
  5750.                A handle can be renamed at any time by setting the handle's
  5751.                name to a new value.  A handle can have its name removed by
  5752.                setting the handle's name to all ASCII nulls.  When a handle
  5753.                is deallocated, its name is removed (set to ASCII nulls).
  5754.  
  5755.  
  5756.           CALLING PARAMETERS
  5757.  
  5758.                AX = 5301h
  5759.                    Contains the Set Handle Name function.
  5760.  
  5761.                DX = handle number
  5762.                    Contains the EMM handle.
  5763.  
  5764.                DS:SI = pointer to handle_name
  5765.                    Contains a pointer to a byte array which contains the
  5766.                    name that is to be assigned to the handle.  The handle
  5767.                    name must be padded with nulls if the name is less than
  5768.                    eight characters long.
  5769.  
  5770.  
  5771.           REGISTERS MODIFIED
  5772.  
  5773.                AX
  5774.  
  5775.  
  5776.           STATUS
  5777.  
  5778.                AH = 0   SUCCESSFUL.
  5779.                    The handle name has been assigned.
  5780.  
  5781.  
  5782.  
  5783.           EMM Functions                                                  93
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.           Function 20. Get/Set Handle Name
  5790.           Set Handle Name subfunction
  5791.  
  5792.  
  5793.  
  5794.                AH = 80h   NON-RECOVERABLE.
  5795.                    The manager detected a malfunction in the memory manager
  5796.                    software.
  5797.  
  5798.                AH = 81h   NON-RECOVERABLE.
  5799.                    The manager detected a malfunction in the expanded
  5800.                    memory hardware.
  5801.  
  5802.                AH = 83h   NON-RECOVERABLE.
  5803.                    The manager could not find the specified EMM handle. 
  5804.                    The manager doesn't have any information pertaining to
  5805.                    the specified EMM handle.  The program may have cor-
  5806.                    rupted its EMM handle.
  5807.  
  5808.                AH = 84h   NON-RECOVERABLE.
  5809.                    The function code passed to the memory manager is not
  5810.                    defined.
  5811.  
  5812.                AH = 8Fh   NON-RECOVERABLE.
  5813.                    The subfunction parameter is invalid.
  5814.  
  5815.                AH = A1h   RECOVERABLE.
  5816.                    A handle with this name already exists.  The specified
  5817.                    handle was not assigned a name.
  5818.  
  5819.  
  5820.           EXAMPLE
  5821.  
  5822.           handle_name                    DB 'AARDVARK'
  5823.           emm_handle                     DW ?
  5824.  
  5825.           MOV   AX,SEG handle_name
  5826.           MOV   DS,AX
  5827.           LEA   SI,handle_name           ; DS:SI points to handle_name
  5828.           MOV   DX,emm_handle            ; specify EMM handle
  5829.           MOV   AX,5301h                 ; load function code
  5830.           INT   67h                      ; call the memory manager
  5831.           OR    AH,AH                    ; check EMM status
  5832.           JNZ   emm_err_handler          ; jump to error handler on error
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.           EMM Functions                                                  94
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.           Function 21. Get Handle Directory
  5849.           Get Handle Directory subfunction
  5850.  
  5851.  
  5852.  
  5853.           PURPOSE
  5854.  
  5855.                This function returns an array which contains all active
  5856.                handles and the names associated with each.  Handles which
  5857.                have not been assigned names have a default name of all
  5858.                ASCII nulls (binary zeros).  When a handle is first allo-
  5859.                cated, or when all the pages belonging to a handle are
  5860.                deallocated (that is, an open handle is closed), its default
  5861.                name is set to ASCII nulls.  It takes a subsequent assign-
  5862.                ment of a name for a handle to have a name after it has been
  5863.                opened.  The full range of values may be assigned to each
  5864.                character in a name (that is, 00h through FFh).
  5865.  
  5866.                The number of bytes required by the array is:
  5867.  
  5868.                            10 bytes * total number of handles
  5869.  
  5870.                The maximum size of this array is:
  5871.  
  5872.                            (10 bytes/entry) * 255 entries = 2550 bytes.
  5873.  
  5874.  
  5875.           CALLING PARAMETERS
  5876.  
  5877.                AX = 5400h
  5878.                    Contains the Get Handle Directory function.
  5879.  
  5880.                    handle_dir_struct               STRUC
  5881.                        handle_value                DW ?
  5882.                        handle_name                 DB 8 DUP (?)
  5883.                    handle_dir_struct               ENDS
  5884.  
  5885.                ES:DI = pointer to handle_dir
  5886.                    Contains a pointer to an area of memory into which the
  5887.                    memory manager will copy the handle directory.  The
  5888.                    handle directory is an array of structures.  There are
  5889.                    as many entries in the array as there are open EMM
  5890.                    handles.  The structure consists of the following
  5891.                    elements:
  5892.  
  5893.                    .handle_value
  5894.                        The first member is a word which contains the value
  5895.                        of the open EMM handle.
  5896.  
  5897.  
  5898.  
  5899.  
  5900.  
  5901.           EMM Functions                                                  95
  5902.  
  5903.  
  5904.  
  5905.  
  5906.  
  5907.           Function 21. Get Handle Directory
  5908.           Get Handle Directory subfunction
  5909.  
  5910.  
  5911.  
  5912.                    .handle_name
  5913.                        The second member is an 8 byte array which contains
  5914.                        the ASCII name associated with the EMM handle.  If
  5915.                        there is no name currently associated with the
  5916.                        handle, it has a value of all zeros (ASCII nulls).
  5917.  
  5918.  
  5919.           RESULTS
  5920.  
  5921.                These results are valid only if the status returned is zero.
  5922.  
  5923.                handle_dir
  5924.                    Contains the handle values and handle names associated
  5925.                    with each handle value.
  5926.  
  5927.                AL = number of entries in the handle_dir array
  5928.                    Contains the number of entries in the handle directory
  5929.                    array.  This is also the same as the number of open
  5930.                    handles.  For example, if only one handle is active, AL
  5931.                    will contain a one.
  5932.  
  5933.  
  5934.           REGISTERS MODIFIED
  5935.  
  5936.                AX
  5937.  
  5938.  
  5939.           STATUS
  5940.  
  5941.                AH = 0   SUCCESSFUL.
  5942.                    The handle directory has been returned.
  5943.  
  5944.                AH = 80h   NON-RECOVERABLE.
  5945.                    The manager detected a malfunction in the memory manager
  5946.                    software.
  5947.  
  5948.                AH = 81h   NON-RECOVERABLE.
  5949.                    The manager detected a malfunction in the expanded
  5950.                    memory hardware.
  5951.  
  5952.                AH = 84h   NON-RECOVERABLE.
  5953.                    The function code passed to the memory manager is not
  5954.                    defined.
  5955.  
  5956.                AH = 8Fh   NON-RECOVERABLE.
  5957.                    The subfunction parameter is invalid.
  5958.  
  5959.  
  5960.           EMM Functions                                                  96
  5961.  
  5962.  
  5963.  
  5964.  
  5965.  
  5966.           Function 21. Get Handle Directory
  5967.           Get Handle Directory subfunction
  5968.  
  5969.  
  5970.  
  5971.           EXAMPLE
  5972.  
  5973.           handle_dir                    handle_dir_struct 255 DUP (?)
  5974.  
  5975.           num_entries_in_handle_dir     DB ?
  5976.  
  5977.           MOV   AX,SEG handle_dir
  5978.           MOV   ES,AX
  5979.           LEA   DI,handle_dir                 ; ES:DI points to handle_dir
  5980.           MOV   AX,5400h                      ; load function code
  5981.           INT   67h                           ; call the memory manager
  5982.           OR    AH,AH                         ; check EMM status
  5983.           JNZ   emm_err_handler               ; jump to error handler on   
  5984.                                               ; error
  5985.           MOV   num_entries_in_handle_dir,AL  ; save number of entries
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.  
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.           EMM Functions                                                  97
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.           Function 21. Get Handle Directory
  6026.           Search For Named Handle subfunction
  6027.  
  6028.  
  6029.  
  6030.           PURPOSE
  6031.  
  6032.                This subfunction searches the handle name directory for a
  6033.                handle with a particular name.  If the named handle is
  6034.                found, this subfunction returns the handle number associated
  6035.                with the name.  At the time of installation, all handles
  6036.                have their names initialized to ASCII nulls.  A handle with
  6037.                a name which is all ASCII nulls has, by definition, no name. 
  6038.                When a handle is assigned a name, at least one character in
  6039.                the name must be a non-null character in order to distin-
  6040.                guish it from a handle without a name.
  6041.  
  6042.  
  6043.           CALLING PARAMETERS
  6044.  
  6045.                AX = 5401h
  6046.                    Contains the Search for Named Handle subfunction.
  6047.  
  6048.                DS:SI = handle_name
  6049.                    Contains a pointer to an 8-byte string that contains the
  6050.                    name of the handle being searched for.
  6051.  
  6052.  
  6053.           RESULTS
  6054.  
  6055.                These results are valid only if the status returned is zero.
  6056.  
  6057.                DX = value of named handle
  6058.                    The value of the handle which matches the handle name
  6059.                    specified.
  6060.  
  6061.  
  6062.           REGISTERS MODIFIED
  6063.  
  6064.                AX, DX
  6065.  
  6066.  
  6067.           STATUS
  6068.  
  6069.                AH = 0   SUCCESSFUL.
  6070.                    The handle value for the named handle has been found.
  6071.  
  6072.                AH = 80h   NON-RECOVERABLE.
  6073.                    The manager detected a malfunction in the memory manager
  6074.                    software.
  6075.  
  6076.  
  6077.  
  6078.           EMM Functions                                                  98
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084.           Function 21. Get Handle Directory
  6085.           Search For Named Handle subfunction
  6086.  
  6087.  
  6088.  
  6089.                AH = 81h   NON-RECOVERABLE.
  6090.                    The manager detected a malfunction in the expanded
  6091.                    memory hardware.
  6092.  
  6093.                AH = 84h   NON-RECOVERABLE.
  6094.                    The function code passed to the memory manager is not
  6095.                    defined.
  6096.  
  6097.                AH = 8Fh   NON-RECOVERABLE.
  6098.                    The subfunction parameter is invalid.
  6099.  
  6100.                AH = A0h   NON-RECOVERABLE.
  6101.                    No corresponding handle could be found for the handle
  6102.                    name specified.
  6103.  
  6104.                AH = A1h   NON-RECOVERABLE.
  6105.                    A handle found had no name (all ASCII nulls).
  6106.  
  6107.  
  6108.           EXAMPLE
  6109.  
  6110.           named_handle                   DB 'AARDVARK'
  6111.           named_handle_value             DW ?
  6112.  
  6113.           MOV   AX,SEG named_handle
  6114.           MOV   DS,AX
  6115.           LEA   SI,named_handle          ; DS:SI points to named_handle
  6116.           MOV   AX,5401h                 ; load function code
  6117.           INT   67h                      ; call the memory manager
  6118.           OR    AH,AH                    ; check EMM status
  6119.           JNZ   emm_err_handler          ; jump to error handler on error
  6120.           MOV   named_handle_value,DX    ; save value of named handle
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.           EMM Functions                                                  99
  6138.  
  6139.  
  6140.  
  6141.  
  6142.  
  6143.           Function 21. Get Handle Directory
  6144.           Get Total Handles subfunction
  6145.  
  6146.  
  6147.  
  6148.           PURPOSE
  6149.  
  6150.                This subfunction returns the total number of handles that
  6151.                the memory manager supports, including the operating system
  6152.                handle (handle value 0).
  6153.  
  6154.  
  6155.           CALLING PARAMETERS
  6156.  
  6157.                AX = 5402h
  6158.                    Contains the Get Total Handles subfunction.
  6159.  
  6160.  
  6161.           RESULTS
  6162.  
  6163.                These results are valid only if the status returned is zero.
  6164.  
  6165.                BX = total_handles
  6166.                    The value returned represents the maximum number of
  6167.                    handles which a program may request the memory manager
  6168.                    to allocate memory to.  The value returned includes the
  6169.                    operating system handle (handle value 0).
  6170.  
  6171.  
  6172.           REGISTERS MODIFIED
  6173.  
  6174.                AX, BX
  6175.  
  6176.  
  6177.           STATUS
  6178.  
  6179.                AH = 0   SUCCESSFUL.
  6180.                    The total number of handles supported has been returned.
  6181.  
  6182.                AH = 80h   NON-RECOVERABLE.
  6183.                    The manager detected a malfunction in the memory manager
  6184.                    software.
  6185.  
  6186.                AH = 81h   NON-RECOVERABLE.
  6187.                    The manager detected a malfunction in the expanded
  6188.                    memory hardware.
  6189.  
  6190.                AH = 84h   NON-RECOVERABLE.
  6191.                    The function code passed to the memory manager is not
  6192.                    defined.
  6193.  
  6194.  
  6195.  
  6196.           EMM Functions                                                 100
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.           Function 21. Get Handle Directory
  6203.           Get Total Handles subfunction
  6204.  
  6205.  
  6206.  
  6207.                AH = 8Fh   NON-RECOVERABLE.
  6208.                    The subfunction parameter is invalid.
  6209.  
  6210.  
  6211.           EXAMPLE
  6212.  
  6213.           total_handles                  DW ?
  6214.  
  6215.           MOV   AX,5402h                 ; load function code
  6216.           INT   67h                      ; call the memory manager
  6217.           OR    AH,AH                    ; check EMM status
  6218.           JNZ   emm_err_handler          ; jump to error handler on error
  6219.           MOV   total_handles,BX         ; save total handle count
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.  
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244.  
  6245.  
  6246.  
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.           EMM Functions                                                 101
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.           Function 22. Alter Page Map & Jump
  6262.  
  6263.  
  6264.  
  6265.           PURPOSE
  6266.  
  6267.                This function alters the memory mapping context and trans-
  6268.                fers control to the specified address.  It is analogous to
  6269.                the FAR JUMP in the 8086 family architecture.  The memory
  6270.                mapping context which existed before the invocation of this
  6271.                function is lost.
  6272.  
  6273.                Mapping no pages and jumping is not considered an error.  If
  6274.                a request to map zero pages and jump is made, control is
  6275.                transferred to the target address, and this function
  6276.                performs a far jump.
  6277.  
  6278.  
  6279.           CALLING PARAMETERS
  6280.  
  6281.                AH = 55h
  6282.                    Contains the Alter Page Map & Jump function.
  6283.  
  6284.                    log_phys_map_struct             STRUC
  6285.                        log_page_number             DW ?
  6286.                        phys_page_number_seg        DW ?
  6287.                    log_phys_map_struct             ENDS
  6288.  
  6289.                    map_and_jump_struct             STRUC
  6290.                        target_address              DD ?
  6291.                        log_phys_map_len            DB ?
  6292.                        log_phys_map_ptr            DD ?
  6293.                    map_and_jump_struct             ENDS
  6294.  
  6295.                AL = physical page number/segment selector
  6296.                    Contains a code which indicates whether the value
  6297.                    contained in the
  6298.  
  6299.                        .log_phys_map.phys_page_number_seg
  6300.  
  6301.                    members are physical page numbers or are the segment
  6302.                    address representation of the physical page numbers.  A
  6303.                    zero in AL indicates that the values are physical page
  6304.                    numbers.  A one in AL indicates that the values in these
  6305.                    members are the segment address representations of the
  6306.                    physical page numbers.
  6307.  
  6308.                DX = handle number
  6309.                    Contains the EMM handle.
  6310.  
  6311.  
  6312.  
  6313.  
  6314.           EMM Functions                                                 102
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.           Function 22. Alter Page Map & Jump
  6321.  
  6322.  
  6323.  
  6324.                DS:SI = pointer to map_and_jump structure
  6325.                    Contains a pointer to a structure that contains the
  6326.                    information necessary to map the desired physical pages
  6327.                    and jump to the target address.  The structure consists
  6328.                    of the following elements:
  6329.  
  6330.                    .target_address
  6331.                        The first member is a far pointer which contains the
  6332.                        target address to which control is to be trans-
  6333.                        ferred.  The address is represented in segment:of-
  6334.                        fset format.  The offset portion of the address is
  6335.                        stored in the low portion of the double word.
  6336.  
  6337.                    .log_phys_map_len
  6338.                        The second member is a byte which contains the
  6339.                        number of entries in the array of structures which
  6340.                        immediately follows it.  The array is as long as the
  6341.                        application developer needs in order to map the
  6342.                        desired logical pages into physical pages.
  6343.  
  6344.                    .log_phys_map_ptr
  6345.                        The third member is a pointer to an array of struc-
  6346.                        tures which contain the logical page numbers and
  6347.                        physical pages or segment address at which they are
  6348.                        to be mapped.  Each entry in the array of structures
  6349.                        contains the following two elements:
  6350.  
  6351.                    .log_page_number
  6352.                        The first member of this structure is a word which
  6353.                        contains the number of the logical page to be
  6354.                        mapped.
  6355.  
  6356.                    .phys_page_number_seg
  6357.                        The second member of this structure is a word which
  6358.                        contains either the physical page number or the
  6359.                        segment address representation of the physical page
  6360.                        number at which the previous logical page number is
  6361.                        to be mapped.  The value passed in AL determines the
  6362.                        type of representation.
  6363.  
  6364.  
  6365.           REGISTERS MODIFIED
  6366.  
  6367.                AX
  6368.  
  6369.  
  6370.  
  6371.  
  6372.  
  6373.           EMM Functions                                                 103
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.           Function 22. Alter Page Map & Jump
  6380.  
  6381.  
  6382.  
  6383.           Note............................................................
  6384.                Values in registers which don't contain required parameters
  6385.                maintain the values across the jump.  The values in regis-
  6386.                ters (with the exception of AX) and the flag state at the
  6387.                beginning of the function are still in the registers and
  6388.                flags when the target address is reached.
  6389.  
  6390.  
  6391.           STATUS
  6392.  
  6393.                AH = 0   SUCCESSFUL.
  6394.                    Control has been transferred to the target address.
  6395.  
  6396.                AH = 80h   NON-RECOVERABLE.
  6397.                    The manager detected a malfunction in the memory manager
  6398.                    software.
  6399.  
  6400.                AH = 81h   NON-RECOVERABLE.
  6401.                    The manager detected a malfunction in the expanded
  6402.                    memory hardware.
  6403.  
  6404.                AH = 83h   NON-RECOVERABLE.
  6405.                    The manager could not find the specified EMM handle. 
  6406.                    The manager doesn't have any information pertaining to
  6407.                    the specified EMM handle.  The program may have cor-
  6408.                    rupted its EMM handle.
  6409.  
  6410.                AH = 84h   NON-RECOVERABLE.
  6411.                    The function code passed to the memory manager is not
  6412.                    defined.
  6413.  
  6414.                AH = 8Ah   RECOVERABLE.
  6415.                    One or more of the logical pages to map into a cor-
  6416.                    responding physical page is out of the range of logical
  6417.                    pages which are allocated to the EMM handle.  The
  6418.                    program can recover from this condition by mapping a
  6419.                    logical page which is within the bounds for the EMM
  6420.                    handle.
  6421.  
  6422.                AH = 8Bh   RECOVERABLE.
  6423.                    One or more of the physical pages is out of the range of
  6424.                    allowable physical pages.  Physical page numbers are
  6425.                    numbered zero-relative.  The program can recover from
  6426.                    this condition by mapping into memory at a physical page
  6427.                    which is in the range of supported physical pages.
  6428.  
  6429.                AH = 8Fh   NON-RECOVERABLE.
  6430.                    The subfunction parameter is invalid.
  6431.  
  6432.           EMM Functions                                                 104
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.           Function 22. Alter Page Map & Jump
  6439.  
  6440.  
  6441.  
  6442.           EXAMPLE
  6443.  
  6444.           log_phys_map              log_phys_map_struct (?) DUP (?)
  6445.  
  6446.           map_and_jump              map_and_jump_struct (?)
  6447.  
  6448.           emm_handle                          DW ?
  6449.           phys_page_or_seg_mode               DB ?
  6450.  
  6451.           MOV   AX,SEG map_and_jump
  6452.           MOV   DS,AX
  6453.           LEA   SI,map_and_jump               ; DS:SI points to
  6454.                                               ; map_and_jump
  6455.           MOV   DX,emm_handle
  6456.           MOV   AH,55h                        ; load function code
  6457.           MOV   AL,phys_page_or_seg_mode      ; specify physical page
  6458.                                               ; or segment mode
  6459.           INT   67h                           ; call memory manager
  6460.           OR    AH,AH                         ; check EMM status
  6461.           JNZ   emm_err_handler               ; jump to error handler on   
  6462.                                               ; error
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.           EMM Functions                                                 105
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.           Function 23. Alter Page Map & Call
  6498.           Alter Page Map & Call subfunction
  6499.  
  6500.  
  6501.  
  6502.           PURPOSE
  6503.  
  6504.                This subfunction saves the current memory mapping context,
  6505.                alters the specified memory mapping context, and transfers
  6506.                control to the specified address.  It is analogous to the
  6507.                FAR CALL in the 8086 family architecture.  Just as a return
  6508.                from a FAR CALL restores the original value in the code
  6509.                segment register, this subfunction restores the state of the
  6510.                specified mapping context after the return.
  6511.  
  6512.                There is no explicit expanded memory subfunction which
  6513.                emulates a return from a FAR CALL.  However, this facility
  6514.                is implicitly available through the standard return from a
  6515.                FAR CALL.  The following paragraphs describe how this works:
  6516.  
  6517.                After this function is invoked, unless an error is detected,
  6518.                the memory manager will transfer control to the address
  6519.                specified.  If an error occurs, the memory manager returns
  6520.                immediately with the error code in the AH register. 
  6521.                Otherwise, the memory manager pushes on the stack informa-
  6522.                tion which enables it to restore the mapping context after
  6523.                the return.
  6524.  
  6525.                When the called procedure wants to return to the calling
  6526.                procedure, it simply issues a standard FAR RETURN.  The
  6527.                memory manager traps this return, restores the specified
  6528.                mapping context, and returns to the calling procedure.  The
  6529.                memory manager also returns a status from a successful
  6530.                return just as it does for all functions.
  6531.  
  6532.                Developers using this subfunction must make allowances for
  6533.                the additional stack space this subfunction will use.
  6534.  
  6535.  
  6536.           CALLING PARAMETERS
  6537.  
  6538.                AH = 56h
  6539.                    Contains the Alter Page Map & Call function.
  6540.  
  6541.                    log_phys_map_struct             STRUC
  6542.                        log_page_number             DW ?
  6543.                        phys_page_number_seg        DW ?
  6544.                    log_phys_map_struct             ENDS
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.           EMM Functions                                                 106
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.           Function 23. Alter Page Map & Call
  6557.           Alter Page Map & Call subfunction
  6558.  
  6559.  
  6560.  
  6561.                    map_and_call_struct             STRUC
  6562.                        target_address              DD ?
  6563.                        new_page_map_len            DB ?
  6564.                        new_page_map_ptr            DD ?
  6565.                        old_page_map_len            DB ?
  6566.                        old_page_map_ptr            DD ?
  6567.                        reserved                    DW 4 DUP (?)
  6568.                    map_and_call_struct             ENDS
  6569.  
  6570.                AL = physical page number/segment selector
  6571.                    Contains a code which indicates whether the value
  6572.                    contained in the
  6573.  
  6574.                        .new_page_map.phys_page_number_seg
  6575.                        .old_page_map.phys_page_number_seg
  6576.  
  6577.                    members are physical page numbers or are the segment
  6578.                    address representation of the physical page numbers.  A
  6579.                    value of zero in AL indicates that the values in these
  6580.                    members are physical page numbers.  A value of one in AL
  6581.                    indicates that the values in these members are the
  6582.                    segment address representations of the physical page
  6583.                    numbers.
  6584.  
  6585.                DX = handle number
  6586.                    Contains the EMM handle.
  6587.  
  6588.                DS:SI = pointer to map_and_call structure
  6589.                    Contains a pointer to a structure which contains the
  6590.                    information necessary to map the desired physical pages
  6591.                    and call the target address.  The structure members are
  6592.                    described here:
  6593.  
  6594.                    .target_address
  6595.                        The first member is a far pointer which contains the
  6596.                        target address to which control is to be trans-
  6597.                        ferred.  The address is represented in segment:of-
  6598.                        fset format.  The offset portion of the address is
  6599.                        stored in the low portion of the pointer.  The
  6600.                        application must supply this value.
  6601.  
  6602.                    .new_page_map_len
  6603.                        The second member is a byte which contains the
  6604.                        number of entries in the new mapping context to
  6605.                        which new_page_map_ptr points.
  6606.  
  6607.  
  6608.  
  6609.           EMM Functions                                                 107
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.           Function 23. Alter Page Map & Call
  6616.           Alter Page Map & Call subfunction
  6617.  
  6618.  
  6619.  
  6620.                    .new_page_map_ptr
  6621.                        The third member is a far pointer that points to an
  6622.                        array of structures which contains a list of the
  6623.                        logical page numbers and the physical page num-
  6624.                        bers/segments at which they are to be mapped im-
  6625.                        mediately after the call.  The contents of the new
  6626.                        array of structures are described at the end of the
  6627.                        map_and_call structure.
  6628.  
  6629.                    .old_page_map_len
  6630.                        The fourth member is a byte which contains the
  6631.                        number of entries in the old mapping context to
  6632.                        which old_page_map_ptr points.
  6633.  
  6634.                    .old_page_map_ptr
  6635.                        The fifth member is a far pointer that points to an
  6636.                        array of structures which contains a list of the
  6637.                        logical page numbers and the physical page num-
  6638.                        bers/segments at which they are to be mapped im-
  6639.                        mediately after the return.  The contents of the old
  6640.                        array of structures are described at the end of the
  6641.                        map_and_call structure.
  6642.  
  6643.                    .reserved
  6644.                        The sixth member is reserved for use by the memory
  6645.                        manager.
  6646.  
  6647.                Each entry in the old and new array of structures contains
  6648.                two elements:
  6649.  
  6650.                    .log_page_number
  6651.                        The first member of this structure is a word which
  6652.                        contains a logical page number which is to be mapped
  6653.                        at the succeeding physical page number/segment
  6654.                        immediately after the CALL (in the case of the new
  6655.                        array of structures) or after the RETURN (in the
  6656.                        case of the old array of structures).
  6657.  
  6658.                    .phys_page_number_seg
  6659.                        The second member of this structure is a word which
  6660.                        contains either the physical page number or the
  6661.                        segment address representation of the physical page
  6662.                        number/segment at which the preceding logical page
  6663.                        is to be mapped immediately after the CALL (in the
  6664.                        case of the new array of structures) or after the
  6665.                        RETURN (in the case of the old array of structures).
  6666.  
  6667.  
  6668.           EMM Functions                                                 108
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.           Function 23. Alter Page Map & Call
  6675.           Alter Page Map & Call subfunction
  6676.  
  6677.  
  6678.  
  6679.           REGISTERS MODIFIED
  6680.  
  6681.                AX
  6682.  
  6683.           Note............................................................
  6684.                Values in registers which don't contain required parameters
  6685.                maintain the values across the call.  The values in regis-
  6686.                ters (with the exception of AX) and the flag state at the
  6687.                beginning of the function are still in the registers and
  6688.                flags when the target address is reached.
  6689.  
  6690.  
  6691.           STATUS
  6692.  
  6693.                AH = 0   SUCCESSFUL.
  6694.                    Control has been transferred to the target address.
  6695.  
  6696.                AH = 80h   NON-RECOVERABLE.
  6697.                    The manager detected a malfunction in the memory manager
  6698.                    software.
  6699.  
  6700.                AH = 81h   NON-RECOVERABLE.
  6701.                    The manager detected a malfunction in the expanded
  6702.                    memory hardware.
  6703.  
  6704.                AH = 83h   NON-RECOVERABLE.
  6705.                    The manager could not find the specified EMM handle. 
  6706.                    The manager doesn't have any information pertaining to
  6707.                    the specified EMM handle.  The program may have cor-
  6708.                    rupted its EMM handle.
  6709.  
  6710.                AH = 84h   NON-RECOVERABLE.
  6711.                    The function code passed to the memory manager is not
  6712.                    defined.
  6713.  
  6714.                AH = 8Ah   RECOVERABLE.
  6715.                    One or more of the logical pages to map into a cor-
  6716.                    responding physical page is out of the range of logical
  6717.                    pages which are allocated to the EMM handle.  The
  6718.                    program can recover from this condition by mapping a
  6719.                    logical page which is within the bounds for the EMM
  6720.                    handle.
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.           EMM Functions                                                 109
  6728.  
  6729.  
  6730.  
  6731.  
  6732.  
  6733.           Function 23. Alter Page Map & Call
  6734.           Alter Page Map & Call subfunction
  6735.  
  6736.  
  6737.  
  6738.                AH = 8Bh   RECOVERABLE.
  6739.                    One or more of the physical pages is out of the range of
  6740.                    allowable physical pages, or you've specified more
  6741.                    physical pages than exist in the system.  Physical page
  6742.                    numbers are numbered zero-relative.  The program can
  6743.                    recover from this condition by mapping a physical page
  6744.                    which is in the range from zero to three.
  6745.  
  6746.                AH = 8Fh   NON-RECOVERABLE.
  6747.                    The subfunction parameter is invalid.
  6748.  
  6749.  
  6750.           EXAMPLE
  6751.  
  6752.           new_page_map              log_phys_map_struct (?) DUP (?)
  6753.  
  6754.           old_page_map              log_phys_map_struct (?) DUP (?)
  6755.  
  6756.           map_and_call              map_and_call_struct (?)
  6757.  
  6758.           emm_handle                DW ?
  6759.           phys_page_or_seg_mode     DB ?
  6760.  
  6761.           MOV   AX,SEG map_and_call
  6762.           MOV   DS,AX
  6763.           LEA   SI,map_and_call               ; DS:SI points to
  6764.                                               ; map_and_call
  6765.           MOV   DX,emm_handle                 ; specify EMM handle
  6766.           MOV   AH,56h                        ; load function code
  6767.           MOV   AL,phys_page_or_seg_mode      ; specify physical page
  6768.                                               ; or segment mode
  6769.           INT   67h                           ; control is actually
  6770.                                               ; transferred to the called
  6771.                                               ; procedure at this point
  6772.           OR    AH,AH                         ; check EMM status
  6773.           JNZ   emm_err_handler               ; jump to error handler on
  6774.                                               ; error
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.           EMM Functions                                                 110
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.           Function 23. Alter Page Map & Call
  6793.           Get Page Map Stack Space Size subfunction
  6794.  
  6795.  
  6796.  
  6797.           PURPOSE
  6798.  
  6799.                Since the Alter Page Map & Call function pushes additional
  6800.                information onto the stack, this subfunction returns the
  6801.                number of bytes of stack space the function requires.
  6802.  
  6803.  
  6804.           CALLING PARAMETERS
  6805.  
  6806.                AX = 5602h
  6807.                    Contains the Get Page Map Stack Space Size subfunction.
  6808.  
  6809.  
  6810.           RESULTS
  6811.  
  6812.                These results are valid only if the status returned is zero.
  6813.  
  6814.                BX = stack space required
  6815.                    Contains the number of bytes which the Alter Page Map &
  6816.                    Call function will require.  In other words, BX contains
  6817.                    the number (including the return address) which has to
  6818.                    be added to the stack pointer to remove all elements
  6819.                    from the stack.
  6820.  
  6821.  
  6822.           REGISTERS MODIFIED
  6823.  
  6824.                AX, BX
  6825.  
  6826.  
  6827.           STATUS
  6828.  
  6829.                AH = 0   SUCCESSFUL.
  6830.                    The size of the array has been returned.
  6831.  
  6832.                AH = 80h   NON-RECOVERABLE.
  6833.                    The manager detected a malfunction in the memory manager
  6834.                    software.
  6835.  
  6836.                AH = 81h   NON-RECOVERABLE.
  6837.                    The manager detected a malfunction in the expanded
  6838.                    memory hardware.
  6839.  
  6840.                AH = 84h   NON-RECOVERABLE.
  6841.                    The function code passed to the memory manager is not
  6842.                    defined.
  6843.  
  6844.  
  6845.           EMM Functions                                                 111
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.           Function 23. Alter Page Map & Call
  6852.           Get Page Map Stack Space Size subfunction
  6853.  
  6854.  
  6855.  
  6856.                AH = 8Fh   NON-RECOVERABLE.
  6857.                    The subfunction parameter is invalid.
  6858.  
  6859.  
  6860.           EXAMPLE
  6861.  
  6862.           stack_space_reqd               DW ?
  6863.  
  6864.           MOV   AX,5602h                 ; load function code
  6865.           INT   67h                      ; call the memory manager
  6866.           OR    AH,AH                    ; check EMM status
  6867.           JNZ   emm_err_handler          ; jump to error handler on error
  6868.           MOV   stack_space_reqd,BX      ; save required stack size count
  6869.  
  6870.  
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876.  
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.           EMM Functions                                                 112
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.           Function 24. Move/Exchange Memory Region
  6911.           Move Memory Region subfunction
  6912.  
  6913.  
  6914.  
  6915.           PURPOSE
  6916.  
  6917.                This subfunction copies a region of memory in the following
  6918.                memory source/destination combinations.
  6919.  
  6920.                o   conventional memory to conventional memory
  6921.  
  6922.                o   conventional memory to expanded memory
  6923.  
  6924.                o   expanded memory to conventional memory
  6925.  
  6926.                o   expanded memory to expanded memory
  6927.  
  6928.                You do not have to save and restore the expanded memory
  6929.                mapping context to perform these move operations.  The
  6930.                current mapping context is maintained throughout this
  6931.                operation.
  6932.  
  6933.                The length of the region is limited by the amount of
  6934.                expanded memory allocated to the handles specified. 
  6935.                However, in most practical applications, the region length
  6936.                will be considerably smaller.  A region length of zero is
  6937.                not an error, and no move will be performed.
  6938.  
  6939.                A region length which exceeds 16K bytes is not an error.  In
  6940.                this case the function assumes that a group of logical pages
  6941.                is the target for the move.  The logical page specified
  6942.                represents the first logical page in which the move will
  6943.                take place.  If the region length exceeds 16K bytes, or if
  6944.                the region is less than 16K bytes but spans logical pages,
  6945.                there must be sufficient logical pages remaining after the
  6946.                first logical page for the entire region to fit.
  6947.  
  6948.                If your application needs to save a region of conventional
  6949.                memory in expanded memory, you can move it without having to
  6950.                perform a save or restore of the current mapping context. 
  6951.                The memory manager maintains the context.  A move of up to
  6952.                1M bytes may be performed, although practical lengths are
  6953.                substantially less than this value.
  6954.  
  6955.                If the source and destination handles are identical, the
  6956.                source and destination regions are tested for overlap before
  6957.                the move.  If they overlap, the move direction is chosen so
  6958.                that the destination region receives an intact copy of the
  6959.                source region.  A status will be returned indicating that
  6960.                this overlap has occurred.
  6961.  
  6962.  
  6963.           EMM Functions                                                 113
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.           Function 24. Move/Exchange Memory Region
  6970.           Move Memory Region subfunction
  6971.  
  6972.  
  6973.  
  6974.           CALLING PARAMETERS
  6975.  
  6976.                AX = 5700h
  6977.                    Contains the Move Memory Region function.
  6978.  
  6979.                    move_source_dest_struct         STRUC
  6980.                        region_length               DD ?
  6981.                        source_memory_type          DB ?
  6982.                        source_handle               DW ?
  6983.                        source_initial_offset       DW ?
  6984.                        source_initial_seg_page     DW ?
  6985.                        dest_memory_type            DB ?
  6986.                        dest_handle                 DW ?
  6987.                        dest_initial_offset         DW ?
  6988.                        dest_initial_seg_page       DW ?
  6989.                    move_source_dest_struct         ENDS
  6990.  
  6991.                DS:SI = pointer to move_source_dest structure
  6992.                    Contains a pointer to a data structure which contains
  6993.                    the source and destination information for the move. 
  6994.                    The structure members are described here:
  6995.  
  6996.                    .region_length
  6997.                        The first member is a double word which specifies
  6998.                        the length of the memory region (in bytes) to be
  6999.                        moved.
  7000.  
  7001.                    .source_memory_type
  7002.                        The second member is a byte which specifies the type
  7003.                        of memory where the source region resides.  A value
  7004.                        of zero indicates that the source region resides in
  7005.                        conventional memory (excluding the page frame seg-
  7006.                        ment).  A value of one indicates that the source
  7007.                        region resides in expanded memory.
  7008.  
  7009.                    .source_handle
  7010.                        If the source region resides in expanded memory, the
  7011.                        third member is a word which specifies the handle
  7012.                        number associated with the source memory region.  If
  7013.                        the source region resides in conventional memory,
  7014.                        this variable has no meaning and should be set to
  7015.                        zero for future compatibility.
  7016.  
  7017.                    .source_initial_offset
  7018.                        The fourth member is a word which specifies the
  7019.                        offset within the source region from which to begin
  7020.                        the move.
  7021.  
  7022.           EMM Functions                                                 114
  7023.  
  7024.  
  7025.  
  7026.  
  7027.  
  7028.           Function 24. Move/Exchange Memory Region
  7029.           Move Memory Region subfunction
  7030.  
  7031.  
  7032.  
  7033.                        If the source region resides in expanded memory, the
  7034.                        source_initial_offset is relative to the beginning
  7035.                        of the 16K logical page.  Because the offset is
  7036.                        relative to the beginning of a 16K expanded memory
  7037.                        page, it may only take on values between 0000h and
  7038.                        3FFFh.
  7039.  
  7040.                        If the source region resides in conventional memory,
  7041.                        the source_initial_offset is a word which specifies
  7042.                        the offset, relative to the beginning of the source
  7043.                        segment, from which to begin the move.  Because the
  7044.                        offset is relative to the beginning of a 64K-byte
  7045.                        conventional memory segment, it may take on values
  7046.                        between 0000h and FFFFh.
  7047.  
  7048.                    .source_initial_seg_page
  7049.                        The fifth member is a word which specifies the
  7050.                        initial segment or logical page number within the
  7051.                        source region from which to begin the move.
  7052.  
  7053.                        If the source region resides in expanded memory, the
  7054.                        value specifies the logical page within the source
  7055.                        region from which to begin the move.
  7056.  
  7057.                        If the source region resides in conventional memory,
  7058.                        the source_initial_seg_page specifies the initial
  7059.                        segment address within conventional memory from
  7060.                        which to begin the move.
  7061.  
  7062.                    .dest_memory_type
  7063.                        The sixth member is a byte which specifies the type
  7064.                        of memory where the destination region resides.  A
  7065.                        value of zero indicates conventional memory; a value
  7066.                        of one indicates expanded memory.
  7067.  
  7068.                    .dest_handle
  7069.                        If the destination region resides in expanded
  7070.                        memory, the seventh member is a word which specifies
  7071.                        the handle number associated with the destination
  7072.                        memory region.  If the destination region resides in
  7073.                        conventional memory, this variable has no meaning
  7074.                        and should be set to zero for future compatibility.
  7075.  
  7076.                    .dest_initial_offset
  7077.                        The eighth member is a word which specifies the
  7078.                        offset within the destination region from which to
  7079.                        begin the move.
  7080.  
  7081.           EMM Functions                                                 115
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.           Function 24. Move/Exchange Memory Region
  7088.           Move Memory Region subfunction
  7089.  
  7090.  
  7091.  
  7092.                        If the destination region resides in expanded
  7093.                        memory, the dest_initial_offset is relative to the
  7094.                        beginning of the 16K-byte logical page.  Because the
  7095.                        offset is relative to the beginning of a 16K-byte
  7096.                        expanded memory page, it may only take on values
  7097.                        between 0000h and 3FFFh.
  7098.  
  7099.                        If the destination region resides in conventional
  7100.                        memory, the dest_initial_offset is a word which
  7101.                        specifies the offset, relative to the beginning of
  7102.                        the destination segment, to begin the move.  Because
  7103.                        the offset is relative to the beginning of a 64K
  7104.                        conventional memory segment, it make take on values
  7105.                        between 0000h and FFFFh.
  7106.  
  7107.                    .dest_initial_seg_page
  7108.                        The ninth member is a word which specifies the
  7109.                        initial segment or logical page number within the
  7110.                        destination region from which to begin the move.
  7111.  
  7112.                        If the destination region resides in expanded memory
  7113.                        then the value specifies the logical page within the
  7114.                        destination region from which to begin the move.
  7115.  
  7116.                        If the destination region resides in conventional
  7117.                        memory, the dest_initial_seg_page specifies the
  7118.                        initial segment address within conventional memory
  7119.                        from which to begin the move.
  7120.  
  7121.  
  7122.           REGISTERS MODIFIED
  7123.  
  7124.                AX
  7125.  
  7126.  
  7127.           STATUS
  7128.  
  7129.                AH = 0   SUCCESSFUL.
  7130.                    The memory regions have been moved.
  7131.  
  7132.                AH = 80h   NON-RECOVERABLE.
  7133.                    The manager detected a malfunction in the memory manager
  7134.                    software.
  7135.  
  7136.                AH = 81h   NON-RECOVERABLE.
  7137.                    The manager detected a malfunction in the expanded
  7138.                    memory hardware.
  7139.  
  7140.           EMM Functions                                                 116
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.           Function 24. Move/Exchange Memory Region
  7147.           Move Memory Region subfunction
  7148.  
  7149.  
  7150.  
  7151.                AH = 83h   NON-RECOVERABLE.
  7152.                    The manager couldn't find either the source or destina-
  7153.                    tion EMM handles.  The memory manager doesn't have any
  7154.                    information on the handles specified.  The program may
  7155.                    have corrupted its EMM handles.
  7156.  
  7157.                AH = 84h   NON-RECOVERABLE.
  7158.                    The function code passed to the memory manager is not
  7159.                    defined.
  7160.  
  7161.                AH = 8Ah   NON-RECOVERABLE.
  7162.                    One or more of the logical pages is out of the range of
  7163.                    logical pages allocated to the source/destination
  7164.                    handle.
  7165.  
  7166.                AH = 8Fh   NON-RECOVERABLE.
  7167.                    The subfunction parameter is invalid.
  7168.  
  7169.                AH = 92h   SUCCESSFUL.
  7170.                    The source and destination expanded memory regions have
  7171.                    the same handle and overlap.  This is valid for a move. 
  7172.                    The move has been completed and the destination region
  7173.                    has a full copy of the source region.  However, at least
  7174.                    a portion of the source region has been overwritten by
  7175.                    the move.  Note that the source and destination expanded
  7176.                    memory regions with different handles will never physi-
  7177.                    cally overlap because the different handles specify
  7178.                    totally different regions of expanded memory.
  7179.  
  7180.                AH = 93h   CONDITIONALLY-RECOVERABLE.
  7181.                    The length of the source or destination expanded memory
  7182.                    region specified exceeds the length of the expanded
  7183.                    memory region allocated either the source or destination
  7184.                    handle.  Insufficient pages are allocated to this handle
  7185.                    to move a region of the size specified.  The program can
  7186.                    recover from this condition by allocating additional
  7187.                    pages to the destination or source handle and attempting
  7188.                    to execute the function again.  However, if the applica-
  7189.                    tion program allocated as much expanded memory as it
  7190.                    thought it needed, this may be a program error and is
  7191.                    not recoverable.
  7192.  
  7193.                AH = 94h   NON-RECOVERABLE.
  7194.                    The conventional memory region and expanded memory
  7195.                    region overlap.  This is invalid, the conventional
  7196.                    memory region cannot overlap the expanded memory region.
  7197.  
  7198.  
  7199.           EMM Functions                                                 117
  7200.  
  7201.  
  7202.  
  7203.  
  7204.  
  7205.           Function 24. Move/Exchange Memory Region
  7206.           Move Memory Region subfunction
  7207.  
  7208.  
  7209.  
  7210.                AH = 95h   NON-RECOVERABLE.
  7211.                    The offset within the logical page exceeds the length of
  7212.                    the logical page.  The initial source or destination
  7213.                    offsets within an expanded memory region must be between
  7214.                    0000h and 3FFFh (16383 or (length of a logical page
  7215.                    - 1)).
  7216.  
  7217.                AH = 96h   NON-RECOVERABLE.
  7218.                    Region length exceeds 1M bytes.
  7219.  
  7220.                AH = 98h   NON-RECOVERABLE.
  7221.                    The memory source and destination types are undefined or
  7222.                    not supported.
  7223.  
  7224.                AH = A2h   NON-RECOVERABLE.
  7225.                    An attempt was made to wrap around the 1M-byte address
  7226.                    space of conventional memory during the move.  The
  7227.                    combination of source/destination starting address and
  7228.                    length of the region to be moved exceeds 1M bytes.  No
  7229.                    data was moved.
  7230.  
  7231.  
  7232.           EXAMPLE
  7233.  
  7234.           move_source_dest               move_source_dest_struct (?)
  7235.  
  7236.           MOV   AX,SEG move_source_dest
  7237.           MOV   DS,AX
  7238.           LEA   SI,move_source_dest      ; DS:SI points to move_source_dest
  7239.           MOV   AX,5700h                 ; load function code
  7240.           INT   67h                      ; call the memory manager
  7241.           OR    AH,AH                    ; check EMM status
  7242.           JNZ   emm_err_handler          ; jump to error handler on error
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.           EMM Functions                                                 118
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.           Function 24. Move/Exchange Memory Region
  7265.           Exchange Memory Region subfunction
  7266.  
  7267.  
  7268.  
  7269.           PURPOSE
  7270.  
  7271.                This subfunction exchanges (using a string move) a region of
  7272.                memory in any of the following memory source/destination
  7273.                combinations.
  7274.  
  7275.                o   conventional memory to conventional memory
  7276.  
  7277.                o   conventional memory to expanded memory
  7278.  
  7279.                o   expanded memory to conventional memory
  7280.  
  7281.                o   expanded memory to expanded memory
  7282.  
  7283.                The term expanded memory region refers only to the area of
  7284.                memory above 640K bytes (9FFFFh).  If a system provides
  7285.                mappable conventional memory, this function treats the
  7286.                mappable conventional memory regions as ordinary convention-
  7287.                al memory.  The contents of the source region and the
  7288.                destination region are exchanged.
  7289.  
  7290.                The exchange operation can be performed without having to
  7291.                save and restore the expanded memory mapping context.  The
  7292.                current mapping context is maintained throughout this
  7293.                operation.  The length of the region is limited to the
  7294.                amount of expanded memory allocated to the specified EMM
  7295.                handles.  A length of zero is not an error; however, no
  7296.                exchange will be performed.  A region length which exceeds
  7297.                16K bytes is not an error.  In this case the function
  7298.                assumes that a group of logical pages is the target for the
  7299.                exchange.  The logical page specified represents the first
  7300.                logical page in which the exchange will take place.  If the
  7301.                region length exceeds 16K bytes, or if the region is less
  7302.                than 16K bytes but spans logical pages, there must be
  7303.                sufficient logical pages remaining after the first logical
  7304.                page for the entire region to fit.
  7305.  
  7306.                If your application needs to exchange a region of conven-
  7307.                tional memory with expanded memory, you can simply exchange
  7308.                it with the region of interest without having to perform a
  7309.                save or restore of the current mapping context.  An exchange
  7310.                of up to 1M bytes may be performed, although practical
  7311.                lengths are obviously below that value.  Checking is done
  7312.                before starting the exchange to prevent the possibility of
  7313.                overlap during the exchange operation.  Overlapping source
  7314.                and destination regions for an exchange are invalid, and the
  7315.                exchange will not take place.
  7316.  
  7317.           EMM Functions                                                 119
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.           Function 24. Move/Exchange Memory Region
  7324.           Exchange Memory Region subfunction
  7325.  
  7326.  
  7327.  
  7328.           CALLING PARAMETERS
  7329.  
  7330.                AX = 5701h
  7331.                    Contains the Exchange Memory Region function.
  7332.  
  7333.                    xchg_source_dest_struct         STRUC
  7334.                        region_length               DD ?
  7335.                        source_memory_type          DB ?
  7336.                        source_handle               DW ?
  7337.                        source_initial_offset       DW ?
  7338.                        source_initial_seg_page     DW ?
  7339.                        dest_memory_type            DB ?
  7340.                        dest_handle                 DW ?
  7341.                        dest_initial_offset         DW ?
  7342.                        dest_initial_seg_page       DW ?
  7343.                    xchg_source_dest_struct         ENDS
  7344.  
  7345.                DS:SI = pointer to xchg_source_dest structure
  7346.                    Contains a pointer to the data structure which contains
  7347.                    the source and destination information for the exchange. 
  7348.                    The structure members are described here:
  7349.  
  7350.                    .region_length
  7351.                        The first member is a double word which specifies
  7352.                        the length of the memory region to be exchanged.
  7353.  
  7354.                    .source_memory_type
  7355.                        The second member is a byte which specifies the type
  7356.                        of memory where the source region resides.  A value
  7357.                        of zero indicates that the source region resides in
  7358.                        conventional memory.  A value of one indicates that
  7359.                        the source region resides in expanded memory.
  7360.  
  7361.                    .source_handle
  7362.                        If the source region resides in expanded memory, the
  7363.                        third member is a word which specifies the handle
  7364.                        number associated with the source memory region.  If
  7365.                        the source region resides in conventional memory,
  7366.                        this variable has no meaning and should be set to
  7367.                        zero for future compatibility.
  7368.  
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.           EMM Functions                                                 120
  7377.  
  7378.  
  7379.  
  7380.  
  7381.  
  7382.           Function 24. Move/Exchange Memory Region
  7383.           Exchange Memory Region subfunction
  7384.  
  7385.  
  7386.  
  7387.                    .source_initial_offset
  7388.                        The fourth member is a word which specifies the
  7389.                        offset within the source region from which to begin
  7390.                        the exchange.
  7391.  
  7392.                        If the source region resides in expanded memory, the
  7393.                        source_initial_offset is relative to the beginning
  7394.                        of the 16K logical page.  Because the offset is
  7395.                        relative to the beginning of a 16K expanded memory
  7396.                        page, it may only take on values between 0000h and
  7397.                        3FFFh.
  7398.  
  7399.                        If the source region resides in conventional memory,
  7400.                        the source_initial_offset is a word which specifies
  7401.                        the offset, relative to the beginning of the source
  7402.                        segment, from which to begin the exchange at. 
  7403.                        Because the offset is relative to the beginning of a
  7404.                        64K-byte conventional memory segment, it may take on
  7405.                        values between 0000h and FFFFh.
  7406.  
  7407.                    .source_initial_seg_page
  7408.                        The fifth member is a word which specifies the
  7409.                        initial segment or logical page number within the
  7410.                        source region from which to begin the exchange.
  7411.  
  7412.                        If the source region resides in expanded memory then
  7413.                        the value specifies the logical page within the
  7414.                        source region from which to begin the exchange.
  7415.  
  7416.                        If the source region resides in conventional memory,
  7417.                        the source_initial_seg_page specifies the initial
  7418.                        segment address within conventional memory from
  7419.                        which to begin the exchange.
  7420.  
  7421.                    .dest_memory_type
  7422.                        The sixth member is a byte which specifies the type
  7423.                        of memory where the destination region resides.  A
  7424.                        value of zero indicates that the destination region
  7425.                        resides in conventional memory (excluding the page
  7426.                        frame segment).  A value of one indicates that the
  7427.                        destination region resides in expanded memory.
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  
  7434.  
  7435.           EMM Functions                                                 121
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.           Function 24. Move/Exchange Memory Region
  7442.           Exchange Memory Region subfunction
  7443.  
  7444.  
  7445.  
  7446.                    .dest_handle
  7447.                        If the destination region resides in expanded
  7448.                        memory, the seventh member is a word which specifies
  7449.                        the handle number associated with the destination
  7450.                        memory region.  If the destination region resides in
  7451.                        conventional memory, this variable has no meaning
  7452.                        and should be set to zero for future compatibility.
  7453.  
  7454.                    .dest_initial_offset
  7455.                        The eighth member is a word which specifies the
  7456.                        offset within the destination region from which to
  7457.                        begin the exchange.
  7458.  
  7459.                        If the destination region resides in expanded
  7460.                        memory, the dest_initial_offset is relative to the
  7461.                        beginning of the 16K-byte logical page.  Because the
  7462.                        offset is relative to the beginning of a 16K-byte
  7463.                        expanded memory page, it may only take on values
  7464.                        between 0000h and 3FFFh.
  7465.  
  7466.                        If the destination region resides in conventional
  7467.                        memory, the dest_initial_offset is a word which
  7468.                        specifies the offset, relative to the beginning of
  7469.                        the destination segment, to begin the exchange at. 
  7470.                        Because the offset is relative to the beginning of a
  7471.                        64K conventional memory segment, it may take on
  7472.                        values between 0000h and FFFFh.
  7473.  
  7474.                    .dest_initial_seg_page
  7475.                        The ninth member is a word which specifies the
  7476.                        initial segment or logical page number within the
  7477.                        destination region from which to begin the exchange.
  7478.  
  7479.                        If the destination region resides in expanded memory
  7480.                        then the value specifies the logical page within the
  7481.                        destination region from which to begin the exchange.
  7482.  
  7483.                        If the destination region resides in conventional
  7484.                        memory, the dest_initial_seg_page specifies the
  7485.                        initial segment address within conventional memory
  7486.                        from which to begin the exchange.
  7487.  
  7488.  
  7489.  
  7490.           REGISTERS MODIFIED
  7491.  
  7492.                AX
  7493.  
  7494.           EMM Functions                                                 122
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.           Function 24. Move/Exchange Memory Region
  7501.           Exchange Memory Region subfunction
  7502.  
  7503.  
  7504.  
  7505.           STATUS
  7506.  
  7507.                AH = 0   SUCCESSFUL.
  7508.                    The memory regions have been exchanged.
  7509.  
  7510.                AH = 80h   NON-RECOVERABLE.
  7511.                    The manager detected a malfunction in the memory manager
  7512.                    software.
  7513.  
  7514.                AH = 81h   NON-RECOVERABLE.
  7515.                    The manager detected a malfunction in the expanded
  7516.                    memory hardware.
  7517.  
  7518.                AH = 83h   NON-RECOVERABLE.
  7519.                    The manager could not find either the source or destina-
  7520.                    tion EMM handles.  The memory manager does not currently
  7521.                    have any information pertaining to the handles speci-
  7522.                    fied.  The program may have corrupted its EMM handles.
  7523.  
  7524.                AH = 84h   NON-RECOVERABLE.
  7525.                    The function code passed to the memory manager is not
  7526.                    defined.
  7527.  
  7528.                AH = 8Ah   NON-RECOVERABLE.
  7529.                    One or more of the logical pages is out of the range of
  7530.                    logical pages allocated to the source/destination
  7531.                    handle.
  7532.  
  7533.                AH = 8Fh   NON-RECOVERABLE.
  7534.                    The subfunction parameter is invalid.
  7535.  
  7536.                AH = 93h   CONDITIONALLY-RECOVERABLE.
  7537.                    The length of the source or destination expanded memory
  7538.                    region specified, exceeds the length of the expanded
  7539.                    memory region allocated to the source or destination
  7540.                    handle.  There are insufficient pages allocated to this
  7541.                    handle to exchange a region of the size specified.  The
  7542.                    program can recover from this condition by attempting to
  7543.                    allocate additional pages to the destination or source
  7544.                    handle and attempting to execute the function again. 
  7545.                    However, if the application program allocated as much
  7546.                    expanded memory as it thought it needed, this may be a
  7547.                    program error and is therefore not recoverable.
  7548.  
  7549.  
  7550.  
  7551.  
  7552.  
  7553.           EMM Functions                                                 123
  7554.  
  7555.  
  7556.  
  7557.  
  7558.  
  7559.           Function 24. Move/Exchange Memory Region
  7560.           Exchange Memory Region subfunction
  7561.  
  7562.  
  7563.  
  7564.                AH = 94h   NON-RECOVERABLE.
  7565.                    The conventional memory region and expanded memory
  7566.                    region overlap.  This is invalid, the conventional
  7567.                    memory region cannot overlap the expanded memory region.
  7568.  
  7569.                AH = 95h   NON-RECOVERABLE.
  7570.                    The offset within the logical page exceeds the length of
  7571.                    the logical page.  The initial source or destination
  7572.                    offsets within an expanded memory region must be between
  7573.                    0000h and 3FFFh (16383 or (length of a logical page
  7574.                    - 1)).
  7575.  
  7576.                AH = 96h   NON-RECOVERABLE.
  7577.                    Region length exceeds 1M bytes.
  7578.  
  7579.                AH = 97h   NON-RECOVERABLE.
  7580.                    The source and destination expanded memory regions have
  7581.                    the same handle and overlap.  This is invalid, the
  7582.                    source and destination expanded memory regions cannot
  7583.                    have the same handle and overlap when they are being
  7584.                    exchanged.  Note that the source and destination
  7585.                    expanded memory regions which have different handles
  7586.                    will never physically overlap because the different
  7587.                    handles specify totally different regions of expanded
  7588.                    memory.
  7589.  
  7590.                AH = 98h   NON-RECOVERABLE.
  7591.                    The memory source and destination types are undefined or
  7592.                    not supported.
  7593.  
  7594.                AH = A2h   NON-RECOVERABLE.
  7595.                    An attempt was made to wrap around the 1M-byte address
  7596.                    space of conventional memory during the exchange.  The
  7597.                    combination of source/destination starting address and
  7598.                    length of the region to be exchanged exceeds 1M bytes. 
  7599.                    No data was exchanged.
  7600.  
  7601.  
  7602.  
  7603.  
  7604.  
  7605.  
  7606.  
  7607.  
  7608.  
  7609.  
  7610.  
  7611.  
  7612.           EMM Functions                                                 124
  7613.  
  7614.  
  7615.  
  7616.  
  7617.  
  7618.           Function 24. Move/Exchange Memory Region
  7619.           Exchange Memory Region subfunction
  7620.  
  7621.  
  7622.  
  7623.           EXAMPLE
  7624.  
  7625.           xchg_source_dest               xchg_source_dest_struct (?)
  7626.  
  7627.           MOV   AX,SEG xchg_source_dest
  7628.           MOV   DS,AX
  7629.           LEA   SI,xchg_source_dest      ; DS:SI points to xchg_source_dest
  7630.           MOV   AX,5701h                 ; load function code
  7631.           INT   67h                      ; call the memory manager
  7632.           OR    AH,AH                    ; check EMM status
  7633.           JNZ   emm_err_handler          ; jump to error handler on error
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.  
  7654.  
  7655.  
  7656.  
  7657.  
  7658.  
  7659.  
  7660.  
  7661.  
  7662.  
  7663.  
  7664.  
  7665.  
  7666.  
  7667.  
  7668.  
  7669.  
  7670.  
  7671.           EMM Functions                                                 125
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.           Function 25. Get Mappable Physical Address Array
  7678.           Get Mappable Physical Address Array subfunction
  7679.  
  7680.  
  7681.  
  7682.           PURPOSE
  7683.  
  7684.                This subfunction returns an array containing the segment
  7685.                address and physical page number for each mappable physical
  7686.                page in a system.  The contents of this array provide a
  7687.                cross reference between physical page numbers and the actual
  7688.                segment addresses for each mappable page in the system.  The
  7689.                array is sorted in ascending segment order.  This does not
  7690.                mean that the physical page numbers associated with the
  7691.                segment addresses are also in ascending order.
  7692.  
  7693.  
  7694.           CALLING PARAMETERS
  7695.  
  7696.                AX = 5800h
  7697.                    Contains the Get Mappable Physical Address Array
  7698.                    subfunction
  7699.  
  7700.                    mappable_phys_page_struct       STRUC
  7701.                        phys_page_segment           DW ?
  7702.                        phys_page_number            DW ?
  7703.                    mappable_phys_page_struct       ENDS
  7704.  
  7705.                ES:DI = mappable_phys_page
  7706.                    Contains a pointer to an application-supplied memory
  7707.                    area where the memory manager will copy the physical
  7708.                    address array.  Each entry in the array is a structure
  7709.                    containing two members:
  7710.  
  7711.                    .phys_page_segment
  7712.                        The first member is a word which contains the
  7713.                        segment address of the mappable physical page
  7714.                        associated with the physical page number following
  7715.                        it.  The array entries are sorted in ascending
  7716.                        segment address order.
  7717.  
  7718.                    .phys_page_number
  7719.                        The second member is a word which contains the
  7720.                        physical page number which corresponds to the
  7721.                        previous segment address.  The physical page numbers
  7722.                        are not necessarily in ascending order.
  7723.  
  7724.  
  7725.  
  7726.  
  7727.  
  7728.  
  7729.  
  7730.           EMM Functions                                                 126
  7731.  
  7732.  
  7733.  
  7734.  
  7735.  
  7736.           Function 25. Get Mappable Physical Address Array
  7737.           Get Mappable Physical Address Array subfunction
  7738.  
  7739.  
  7740.  
  7741.                    Example 1
  7742.  
  7743.                        An expanded memory board has its page frame starting
  7744.                        at address C0000h and has no mappable conventional
  7745.                        memory.  For this configuration, physical page 0
  7746.                        corresponds to segment address C000h, physical page
  7747.                        1 corresponds to segment address C400h, etc.  The
  7748.                        array would contain the following data (in this
  7749.                        order):
  7750.  
  7751.                        C000h, 00h
  7752.                        C400h, 01h
  7753.                        C800h, 02h
  7754.                        CC00h, 03h
  7755.  
  7756.  
  7757.                    Example 2
  7758.  
  7759.                        An expanded memory board has a large page frame
  7760.                        starting at address C0000h and has mappable conven-
  7761.                        tional memory from 90000h through 9FFFFh.  For this
  7762.                        configuration, physical page 0 corresponds to
  7763.                        segment address C000h, physical page 1 corresponds
  7764.                        to segment address C400h, etc.  The array would
  7765.                        contain the following data in the order specified. 
  7766.                        Note that the expanded memory region always has the
  7767.                        lowest numerically valued physical page numbers.
  7768.  
  7769.                        9000h, 0Ch
  7770.                        9400h, 0Dh
  7771.                        9800h, 0Eh
  7772.                        9C00h, 0Fh
  7773.                        C000h, 00h
  7774.                        C400h, 01h
  7775.                        C800h, 02h
  7776.                        CC00h, 03h
  7777.                        D000h, 04h
  7778.                        D400h, 05h
  7779.                        D800h, 06h
  7780.                        DC00h, 07h
  7781.                        E000h, 08h
  7782.                        E400h, 09h
  7783.                        E800h, 0Ah
  7784.                        EC00h, 0Bh
  7785.  
  7786.  
  7787.  
  7788.  
  7789.           EMM Functions                                                 127
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.           Function 25. Get Mappable Physical Address Array
  7796.           Get Mappable Physical Address Array subfunction
  7797.  
  7798.  
  7799.  
  7800.           RESULTS
  7801.  
  7802.                These results are valid only if the status returned is zero.
  7803.  
  7804.                CX = number of entries in the mappable_phys_page
  7805.                    Multiply this number by (SIZE mappable_phys_page_struct)
  7806.                    to determine the number of bytes the physical page
  7807.                    address array requires.
  7808.  
  7809.  
  7810.           REGISTERS MODIFIED
  7811.  
  7812.                AX, CX
  7813.  
  7814.  
  7815.           STATUS
  7816.  
  7817.                AH = 0   SUCCESSFUL.
  7818.                    The hardware configuration array has been returned.
  7819.  
  7820.                AH = 80h   NON-RECOVERABLE.
  7821.                    The manager detected a malfunction in the memory manager
  7822.                    software.
  7823.  
  7824.                AH = 81h   NON-RECOVERABLE.
  7825.                    The manager detected a malfunction in the expanded
  7826.                    memory hardware.
  7827.  
  7828.                AH = 84h   NON-RECOVERABLE.
  7829.                    The function code passed to the memory manager is not
  7830.                    defined.
  7831.  
  7832.                AH = 8Fh   NON-RECOVERABLE.
  7833.                    The subfunction parameter is invalid.
  7834.  
  7835.  
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.           EMM Functions                                                 128
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.           Function 25. Get Mappable Physical Address Array
  7855.           Get Mappable Physical Address Array subfunction
  7856.  
  7857.  
  7858.  
  7859.           EXAMPLE
  7860.  
  7861.           mappable_phys_page             mappable_phys_page_struct (?)
  7862.  
  7863.           mappable_page_entry_count      DW ?
  7864.  
  7865.           MOV   AX,SEG mappable_phys_page
  7866.           MOV   ES,AX
  7867.           LEA   DI,mappable_phys_page         ; ES:DI points to
  7868.                                               ; mappable_phys_page
  7869.           MOV   AX,5800h                      ; load function code
  7870.           INT   67h                           ; call the memory
  7871.                                               ; manager
  7872.           OR    AH,AH                         ; check EMM status
  7873.           JNZ   emm_err_handler               ; jump to error handler
  7874.                                               ; on error
  7875.           MOV   mappable_page_entry_count,CX  ; save mappable
  7876.                                               ; page entry count
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.  
  7886.  
  7887.  
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907.           EMM Functions                                                 129
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.           Function 25. Get Mappable Physical Address Array
  7914.           Get Mappable Physical Address Array Entries subfunction
  7915.  
  7916.  
  7917.  
  7918.           PURPOSE
  7919.  
  7920.                This subfunction gets the number of entries which will be
  7921.                required for the array the first subfunction returns.
  7922.  
  7923.  
  7924.           CALLING PARAMETERS
  7925.  
  7926.                AX = 5801h
  7927.                    Contains the Get Physical Page Address Array Entries
  7928.                    subfunction.  This subfunction returns a word which
  7929.                    represents the number of entries in the array returned
  7930.                    by the previous subfunction.  This number also repre-
  7931.                    sents the number of mappable physical pages in a system.
  7932.  
  7933.  
  7934.           RESULTS
  7935.  
  7936.                These results are valid only if the status returned is zero.
  7937.  
  7938.                CX = number of entries in the mappable_phys_page
  7939.                    Multiply this number by (SIZE mappable_phys_page_struct)
  7940.                    to determine the number of bytes the physical page
  7941.                    address array will require.
  7942.  
  7943.  
  7944.           REGISTERS MODIFIED
  7945.  
  7946.                AX, CX
  7947.  
  7948.  
  7949.           STATUS
  7950.  
  7951.                AH = 0   SUCCESSFUL.
  7952.                    The number of mappable physical pages has been returned.
  7953.  
  7954.                AH = 80h   NON-RECOVERABLE.
  7955.                    The manager detected a malfunction in the memory manager
  7956.                    software.
  7957.  
  7958.                AH = 81h   NON-RECOVERABLE.
  7959.                    The manager detected a malfunction in the expanded
  7960.                    memory hardware.
  7961.  
  7962.                AH = 84h   NON-RECOVERABLE.
  7963.                    The function code passed to the memory manager is not
  7964.                    defined.
  7965.  
  7966.           EMM Functions                                                 130
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.           Function 25. Get Mappable Physical Address Array
  7973.           Get Mappable Physical Address Array Entries subfunction
  7974.  
  7975.  
  7976.  
  7977.                AH = 8Fh   NON-RECOVERABLE.
  7978.                    The subfunction parameter is invalid.
  7979.  
  7980.  
  7981.           EXAMPLE
  7982.  
  7983.           mappable_page_entry_count           DW ?
  7984.  
  7985.           MOV   AX,5801h                      ; load function code
  7986.           INT   67h                           ; call memory manager
  7987.           OR    AH,AH                         ; check EMM status
  7988.           JNZ   emm_err_handler               ; jump to error handler
  7989.                                               ; on error
  7990.           MOV   mappable_page_entry_count,CX  ; save mappable
  7991.                                               ; page entry count
  7992.  
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.  
  8000.  
  8001.  
  8002.  
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.  
  8009.  
  8010.  
  8011.  
  8012.  
  8013.  
  8014.  
  8015.  
  8016.  
  8017.  
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.           EMM Functions                                                 131
  8026.  
  8027.  
  8028.  
  8029.  
  8030.  
  8031.           Function 26. Get Expanded Memory Hardware Information
  8032.           Get Hardware Configuration Array subfunction
  8033.  
  8034.  
  8035.  
  8036.           Note............................................................
  8037.                This function is for use by operating systems only.  This
  8038.                function can be disabled at any time by the operating
  8039.                system.  Refer to Function 30 for a description of how an
  8040.                operating system does this.
  8041.  
  8042.  
  8043.           PURPOSE
  8044.  
  8045.                This subfunction returns an array containing expanded memory
  8046.                hardware configuration information for use by an operating
  8047.                system/environment.
  8048.  
  8049.  
  8050.           CALLING PARAMETERS
  8051.  
  8052.                AX = 5900h
  8053.                    Contains the Get Hardware Configuration Array subfunc-
  8054.                    tion.
  8055.  
  8056.                    hardware_info_struct            STRUC
  8057.                        raw_page_size               DW ?
  8058.                        alternate_register_sets     DW ?
  8059.                        context_save_area_size      DW ?
  8060.                        DMA_register_sets           DW ?
  8061.                        DMA_channel_operation       DW ?
  8062.                    hardware_info_struct            ENDS
  8063.  
  8064.                ES:DI = hardware_info
  8065.                    Contains a pointer to a memory area that the operating
  8066.                    system supplies where the memory manager will copy
  8067.                    expanded memory hardware information.  The structure
  8068.                    contains these five members:
  8069.  
  8070.                    .raw_page_size
  8071.                        The first member is a word which contains the size
  8072.                        of a raw mappable physical page in paragraphs (16
  8073.                        bytes).  LIM standard pages are always 16K bytes. 
  8074.                        However, other implementations of expanded memory
  8075.                        boards do not necessarily comply with this standard
  8076.                        and can emulate a 16K-byte page by mapping in
  8077.                        multiple smaller pages.  This member specifies the
  8078.                        size of a mappable physical page viewed from the
  8079.                        hardware implementation level.
  8080.  
  8081.  
  8082.  
  8083.  
  8084.           EMM Functions                                                 132
  8085.  
  8086.  
  8087.  
  8088.  
  8089.  
  8090.           Function 26. Get Expanded Memory Hardware Information
  8091.           Get Hardware Configuration Array subfunction
  8092.  
  8093.  
  8094.  
  8095.                    .alternate_register_sets
  8096.                        The second member is a word which specifies the
  8097.                        number of alternate mapping register sets.  The
  8098.                        additional mapping register sets are termed alter-
  8099.                        nate mapping register sets in this document.
  8100.  
  8101.                        All expanded memory boards have at least one set of
  8102.                        hardware registers to perform the logical to
  8103.                        physical page mapping.  Some expanded memory boards
  8104.                        have more than one set of these mapping registers. 
  8105.                        This member specifies how many of these alternate
  8106.                        mapping register sets exist (beyond the one set that
  8107.                        all expanded memory boards have) on the expanded
  8108.                        memory boards in the system.  If an expanded memory
  8109.                        card has only one set of mapping registers (that is,
  8110.                        no alternate mapping register sets) this member has
  8111.                        a value of zero.
  8112.  
  8113.                    .context_save_area_size
  8114.                        The third member is a word which contains the
  8115.                        storage requirements for the array required to save
  8116.                        a mapping context.  The value returned in this
  8117.                        member is exactly the same as that returned by
  8118.                        Function 15 (Get Size of Page Map Save Array
  8119.                        subfunction).
  8120.  
  8121.                    .DMA_register_sets
  8122.                        The fourth member is a word which contains the
  8123.                        number of register sets that can be assigned to DMA
  8124.                        channels.  These DMA register sets, although similar
  8125.                        in use to alternate register sets, are for DMA
  8126.                        mapping and not task mapping.
  8127.  
  8128.                        If the expanded memory hardware does not support DMA
  8129.                        register sets, care must be taken when DMA is taking
  8130.                        place.
  8131.  
  8132.                        In a multitasking operating system, when one task is
  8133.                        waiting for DMA to complete, it is useful to be able
  8134.                        to switch to another task.  However, if the DMA is
  8135.                        taking place in memory that the second task will
  8136.                        need to remap, remapping would be disastrous.
  8137.  
  8138.  
  8139.  
  8140.  
  8141.  
  8142.  
  8143.           EMM Functions                                                 133
  8144.  
  8145.  
  8146.  
  8147.  
  8148.  
  8149.           Function 26. Get Expanded Memory Hardware Information
  8150.           Get Hardware Configuration Array subfunction
  8151.  
  8152.  
  8153.  
  8154.                        If the expanded memory hardware can detect when DMA
  8155.                        is occurring, the OS/E should allow task switches
  8156.                        and remapping during DMA.  If no special support for
  8157.                        DMA is available, no remapping should be done when
  8158.                        DMA is in progress.
  8159.  
  8160.                    .DMA_channel_operation
  8161.                        The fifth member is a word which specifies a special
  8162.                        case for the DMA register sets.  A value of zero
  8163.                        specifies that the DMA register sets behave as
  8164.                        described in Function 28.  A value of one specifies
  8165.                        that the expanded memory hardware has only one DMA
  8166.                        register set.  In addition, if any channel is mapped
  8167.                        through this register set, then all channels are
  8168.                        mapped through it.  For LIM standard boards, this
  8169.                        value is zero.
  8170.  
  8171.  
  8172.           RESULTS
  8173.  
  8174.                These results are valid only if the status returned is zero.
  8175.  
  8176.                hardware_info
  8177.                    Contains the expanded memory hardware-specific informa-
  8178.                    tion described above.
  8179.  
  8180.  
  8181.           REGISTERS MODIFIED
  8182.  
  8183.                AX
  8184.  
  8185.  
  8186.           STATUS
  8187.  
  8188.                AH = 0   SUCCESSFUL.
  8189.                    The hardware configuration array has been returned.
  8190.  
  8191.                AH = 80h   NON-RECOVERABLE.
  8192.                    The manager detected a malfunction in the memory manager
  8193.                    software.
  8194.  
  8195.                AH = 81h   NON-RECOVERABLE.
  8196.                    The manager detected a malfunction in the expanded
  8197.                    memory hardware.
  8198.  
  8199.  
  8200.  
  8201.  
  8202.           EMM Functions                                                 134
  8203.  
  8204.  
  8205.  
  8206.  
  8207.  
  8208.           Function 26. Get Expanded Memory Hardware Information
  8209.           Get Hardware Configuration Array subfunction
  8210.  
  8211.  
  8212.  
  8213.                AH = 84h   NON-RECOVERABLE.
  8214.                    The function code passed to the memory manager is not
  8215.                    defined.
  8216.  
  8217.                AH = 8Fh   NON-RECOVERABLE.
  8218.                    The subfunction parameter is invalid.
  8219.  
  8220.                AH = A4h   NON-RECOVERABLE.
  8221.                    Access to this function has been denied by the operating
  8222.                    system.  The function cannot be used at this time.
  8223.  
  8224.  
  8225.           EXAMPLE
  8226.  
  8227.           hardware_info                  hardware_info_struct (?)
  8228.  
  8229.           MOV   AX,SET hardware_info
  8230.           MOV   ES,AX
  8231.           LEA   DI,hardware_info         ; ES:DI points to hardware_info
  8232.           MOV   AX,5900h                 ; load function code
  8233.           INT   67h                      ; call the memory manager
  8234.           OR    AH,AH                    ; check EMM status
  8235.           JNZ   emm_err_handler          ; jump to error handler on error
  8236.  
  8237.  
  8238.  
  8239.  
  8240.  
  8241.  
  8242.  
  8243.  
  8244.  
  8245.  
  8246.  
  8247.  
  8248.  
  8249.  
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.  
  8260.  
  8261.           EMM Functions                                                 135
  8262.  
  8263.  
  8264.  
  8265.  
  8266.  
  8267.           Function 26. Get Expanded Memory Hardware Information
  8268.           Get Unallocated Raw Page Count subfunction
  8269.  
  8270.  
  8271.  
  8272.           PURPOSE
  8273.  
  8274.                The Get Unallocated Raw Page Count subfunction returns the
  8275.                number of unallocated non-standard length mappable pages as
  8276.                well as the total number of non-standard length mappable
  8277.                pages in expanded memory to the operating system.
  8278.  
  8279.                One variety of expanded memory board has a page size which
  8280.                is a sub-multiple of 16K bytes.  An expanded memory page
  8281.                which is a sub-multiple of 16K is termed a raw page.  An
  8282.                operating system may deal with mappable physical page sizes
  8283.                which are sub-multiples of 16K bytes.
  8284.  
  8285.                If the expanded memory board supplies pages in exact
  8286.                multiples of 16K bytes, the number of pages this function
  8287.                returns is identical to the number Function 3 (Get Unallo-
  8288.                cated Page Count) returns.  In this case, there is no
  8289.                difference between a page and a raw page.
  8290.  
  8291.  
  8292.           CALLING PARAMETERS
  8293.  
  8294.                AX = 5901h
  8295.                    Contains the Get Unallocated Raw Page Count subfunction.
  8296.  
  8297.  
  8298.           RESULTS
  8299.  
  8300.                These results are valid only if the status returned is zero.
  8301.  
  8302.                BX = unallocated raw pages
  8303.                    The number of raw pages that are currently available for
  8304.                    use.
  8305.  
  8306.                DX = total raw pages
  8307.                    The total number of raw pages in expanded memory.
  8308.  
  8309.  
  8310.           REGISTERS MODIFIED
  8311.  
  8312.                AX, BX, DX
  8313.  
  8314.  
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320.           EMM Functions                                                 136
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.           Function 26. Get Expanded Memory Hardware Information
  8327.           Get Unallocated Raw Page Count subfunction
  8328.  
  8329.  
  8330.  
  8331.           STATUS
  8332.  
  8333.                AH = 0   SUCCESSFUL.
  8334.                    The manager has returned the number of unallocated raw
  8335.                    pages and the number of total raw pages in expanded
  8336.                    memory.
  8337.  
  8338.                AH = 80h   NON-RECOVERABLE.
  8339.                    The manager detected a malfunction in the memory manager
  8340.                    software.
  8341.  
  8342.                AH = 81h   NON-RECOVERABLE.
  8343.                    The manager detected a malfunction in the expanded
  8344.                    memory hardware.
  8345.  
  8346.                AH = 84h   NON-RECOVERABLE.
  8347.                    The function code passed to the memory manager is not
  8348.                    defined.
  8349.  
  8350.                AH = 8Fh   NON-RECOVERABLE.
  8351.                    The subfunction parameter is invalid.
  8352.  
  8353.  
  8354.           EXAMPLE
  8355.  
  8356.           unalloc_raw_pages              DW ?
  8357.           total_raw_pages                DW ?
  8358.  
  8359.           MOV   AX,5901h                 ; load function code
  8360.           INT   67h                      ; call the memory manager
  8361.           OR    AH,AH                    ; check EMM status
  8362.           JNZ   emm_err_handler          ; jump to error handler on error
  8363.           MOV   unalloc_raw_pages,BX     ; save unallocated raw page count
  8364.           MOV   total_raw_pages,DX       ; save total raw page count
  8365.  
  8366.  
  8367.  
  8368.  
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.           EMM Functions                                                 137
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.           Function 27. Allocate Raw Pages
  8386.  
  8387.  
  8388.  
  8389.           PURPOSE
  8390.  
  8391.                The Allocate Raw Pages function allocates the number of non-
  8392.                standard size pages that the operating system requests and
  8393.                assigns a unique EMM handle to these pages.  The EMM handle
  8394.                owns these pages until the operating system deallocates
  8395.                them.
  8396.  
  8397.                A hardware vendor may design an expanded memory board that
  8398.                has a page size which is a sub-multiple of 16K bytes.  A
  8399.                physical page which is a sub-multiple of 16K is termed a raw
  8400.                page.  The operating system may deal with page sizes which
  8401.                are sub-multiples of 16K bytes.  The memory manager must
  8402.                treat any function using a handle with raw pages allocated
  8403.                to it by Function 27 differently than it does a handle that
  8404.                has normal 16K-byte pages allocated to it.
  8405.  
  8406.                Handles which are assigned using Function 4 (Allocate Pages)
  8407.                must have pages which are 16K bytes -- this is the length of
  8408.                a standard expanded memory page.  If the expanded memory
  8409.                board hardware is not able to supply 16K-byte pages, the
  8410.                memory manager must emulate pages which are 16K bytes
  8411.                combining multiple non-standard size pages to form a single
  8412.                16K-byte page.
  8413.  
  8414.                Handles which are assigned using this function (Function 27)
  8415.                are called raw handles.  All logical pages allocated to a
  8416.                raw handle have a non-standard length (that is, not 16K
  8417.                bytes).  However, once the operating system has allocated a
  8418.                number of raw pages to a handle, it is the responsibility of
  8419.                the memory manager to recognize that raw handle as one that
  8420.                has non-standard size pages allocated to it.  The memory
  8421.                manager must identify these handles and treat all functions
  8422.                which use handles which have non-standard page lengths
  8423.                differently.  The logical page length becomes the length of
  8424.                the non-standard size page for any raw handle that Function
  8425.                27 assigns.
  8426.  
  8427.  
  8428.           CALLING PARAMETERS
  8429.  
  8430.                AH = 5Ah
  8431.                    Contains the Allocate Raw Pages function.
  8432.  
  8433.                BX = num_of_raw_pages_to_alloc
  8434.                    Contains the number of pages the operating system wishes
  8435.                    to allocate.
  8436.  
  8437.  
  8438.           EMM Functions                                                 138
  8439.  
  8440.  
  8441.  
  8442.  
  8443.  
  8444.           Function 27. Allocate Raw Pages
  8445.  
  8446.  
  8447.  
  8448.           RESULTS
  8449.  
  8450.                These results are valid only if the status returned is zero.
  8451.  
  8452.                DX = raw handle
  8453.                    Contains a unique EMM raw handle.  The operating system
  8454.                    must use this EMM raw handle as a parameter in any
  8455.                    function that requires it.  Up to 255 handles may be
  8456.                    obtained.  (Both Function 4 and Function 27 must share
  8457.                    the same 255 handles).
  8458.  
  8459.                    For all functions using this raw handle, the length of
  8460.                    the physical and logical pages allocated to it are some
  8461.                    non-standard length (that is, not 16K bytes).
  8462.  
  8463.  
  8464.           REGISTERS MODIFIED
  8465.  
  8466.                AX, DX
  8467.  
  8468.  
  8469.           STATUS
  8470.  
  8471.                AH = 0   SUCCESSFUL.
  8472.                    The manager has allocated the raw pages to an assigned
  8473.                    EMM raw handle.
  8474.  
  8475.                AH = 80h   NON-RECOVERABLE.
  8476.                    The manager detected a malfunction in the memory manager
  8477.                    software.
  8478.  
  8479.                AH = 81h   NON-RECOVERABLE.
  8480.                    The manager detected a malfunction in the expanded
  8481.                    memory hardware.
  8482.  
  8483.                AH = 84h   NON-RECOVERABLE.
  8484.                    The function code passed to the memory manager is not
  8485.                    defined.
  8486.  
  8487.                AH = 85h   RECOVERABLE.
  8488.                    All EMM handles are being used.
  8489.  
  8490.                AH = 87h   RECOVERABLE.
  8491.                    There aren't enough expanded memory raw pages present in
  8492.                    the system to satisfy the operating system's request.
  8493.  
  8494.  
  8495.  
  8496.  
  8497.           EMM Functions                                                 139
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.           Function 27. Allocate Raw Pages
  8504.  
  8505.  
  8506.  
  8507.                AH = 88h   RECOVERABLE.
  8508.                    There aren't enough unallocated raw pages to satisfy the
  8509.                    operating system's request.
  8510.  
  8511.  
  8512.           EXAMPLE
  8513.  
  8514.           num_of_raw_pages_to_alloc           DW ?
  8515.           emm_raw_handle                      DW ?
  8516.  
  8517.           MOV   BX,num_of_raw_pages_to_alloc
  8518.           MOV   AH,5Ah                        ; load function code
  8519.           INT   67h                           ; call the memory manager
  8520.           OR    AH,AH                         ; check EMM status
  8521.           JNZ   emm_err_handler               ; jump to error handler
  8522.                                               ; on error
  8523.           MOV   emm_raw_handle,DX             ; save raw handle
  8524.  
  8525.  
  8526.  
  8527.  
  8528.  
  8529.  
  8530.  
  8531.  
  8532.  
  8533.  
  8534.  
  8535.  
  8536.  
  8537.  
  8538.  
  8539.  
  8540.  
  8541.  
  8542.  
  8543.  
  8544.  
  8545.  
  8546.  
  8547.  
  8548.  
  8549.  
  8550.  
  8551.  
  8552.  
  8553.  
  8554.  
  8555.  
  8556.           EMM Functions                                                 140
  8557.  
  8558.  
  8559.  
  8560.  
  8561.  
  8562.           Function 28. Alternate Map Register Set
  8563.  
  8564.  
  8565.  
  8566.           Note............................................................
  8567.                This function is for use by operating systems only.  The
  8568.                operating system can disable this function at any time. 
  8569.                Refer to Function 30 for a description of how an operating
  8570.                system can enable or disable this function.
  8571.  
  8572.  
  8573.           Design Considerations
  8574.  
  8575.                The hardware support for the entire set of subfunctions
  8576.                described is generally not present on every expanded memory
  8577.                board from every vendor of expanded memory board products. 
  8578.                For some of the subfunctions, software emulation is provid-
  8579.                ed.  For other subfunctions, a certain protocol in their use
  8580.                must be observed.  The subfunctions for which this is most
  8581.                crucial are those which address system DMA capabilities.
  8582.  
  8583.  
  8584.           System DMA Capabilities & Expanded Memory Support of DMA
  8585.  
  8586.                In a multitasking operating system, when one task is waiting
  8587.                for DMA to complete, it is useful to be able to switch to
  8588.                another task.  This specification describes a capability
  8589.                which may be designed into expanded memory boards to provide
  8590.                DMA into memory regions which may be mapped out while the
  8591.                DMA is occurring.  For expanded memory boards that do not
  8592.                provide this, it is crucial to understand that while DMA is
  8593.                in progress into a region of mappable memory, the memory
  8594.                mapping context cannot be changed.  That is, all DMA action
  8595.                must be complete before any remapping of pages can be done.
  8596.  
  8597.  
  8598.           Expanded Memory Support of DMA Register Sets
  8599.  
  8600.                Expanded memory boards which have DMA register sets could
  8601.                support DMA into a region of mappable memory while the
  8602.                memory mapping context is being switched.  It is important
  8603.                to realize that these DMA register sets are separate from
  8604.                the alternate map register sets.  An example of how an OS/E
  8605.                might use DMA register sets follows:
  8606.  
  8607.  
  8608.  
  8609.  
  8610.  
  8611.  
  8612.  
  8613.  
  8614.  
  8615.           EMM Functions                                                 141
  8616.  
  8617.  
  8618.  
  8619.  
  8620.  
  8621.           Function 28. Alternate Map Register Set
  8622.  
  8623.  
  8624.  
  8625.                                       Example 1
  8626.  
  8627.                1.  Allocate a DMA register set.
  8628.  
  8629.                2.  Get current register set.
  8630.  
  8631.                3.  Set the DMA register set.
  8632.  
  8633.                4.  Map in the memory desired.
  8634.  
  8635.                5.  Get the DMA register set.
  8636.  
  8637.                6.  Set the original register set.
  8638.  
  8639.                7.  Assign the desired DMA channel to the DMA register set.
  8640.  
  8641.                The preceding set of calls makes all DMA accesses for the
  8642.                desired DMA channel get mapped through the current DMA
  8643.                register set regardless of the current register set.  In
  8644.                other words, the DMA register set overrides the current
  8645.                mapping register set for DMA operations on the DMA channel
  8646.                specified.  A DMA channel that is not assigned to a DMA
  8647.                register set has all its DMA operations mapped through the
  8648.                current mapping register set.
  8649.  
  8650.  
  8651.  
  8652.  
  8653.  
  8654.  
  8655.  
  8656.  
  8657.  
  8658.  
  8659.  
  8660.  
  8661.  
  8662.  
  8663.  
  8664.  
  8665.  
  8666.  
  8667.  
  8668.  
  8669.  
  8670.  
  8671.  
  8672.  
  8673.  
  8674.           EMM Functions                                                 142
  8675.  
  8676.  
  8677.  
  8678.  
  8679.  
  8680.           Function 28. Alternate Map Register Set
  8681.           Get Alternate Map Register Set subfunction
  8682.  
  8683.  
  8684.  
  8685.           Note............................................................
  8686.                This function is for use by operating systems only.  The
  8687.                operating system can disable this function at any time. 
  8688.                Refer to Function 30 for a description of how an operating
  8689.                system can enable or disable this function.
  8690.  
  8691.  
  8692.           PURPOSE
  8693.  
  8694.                The subfunction does one of two things depending on the map
  8695.                register set which is active at the time this function is
  8696.                invoked:
  8697.  
  8698.                1.  If the preceding Set Alternate Map Register Set call was
  8699.                    done with the alternate map register set equal to zero
  8700.                    (BL = 0), then a pointer to a context save area is
  8701.                    returned.  This pointer is always returned for boards
  8702.                    which do not supply alternate mapping register sets. 
  8703.                    This is intended to simulate getting an alternate map
  8704.                    register set.  Note that the memory manager does not
  8705.                    allocate the space for the context:  the operating
  8706.                    system must do so.
  8707.  
  8708.                2.  If the preceding Set Alternate Map Register Set call was
  8709.                    done with the alternate map register set greater than
  8710.                    zero (BL > 0), then the number of the alternate map
  8711.                    register set which is in use at the time that this
  8712.                    function is invoked is returned.
  8713.  
  8714.  
  8715.           CALLING PARAMETERS
  8716.  
  8717.                AX = 5B00h
  8718.                    Contains the Get Alternate Map Register Set subfunction.
  8719.  
  8720.  
  8721.           RESULTS
  8722.  
  8723.                These results are valid only if the status returned is zero.
  8724.  
  8725.                If BL <> 0, current active alternate map register set number
  8726.                    Contains the alternate map register set which was active
  8727.                    at the time that this function was invoked.
  8728.  
  8729.                ES:DI   Unaffected.
  8730.  
  8731.  
  8732.  
  8733.           EMM Functions                                                 143
  8734.  
  8735.  
  8736.  
  8737.  
  8738.  
  8739.           Function 28. Alternate Map Register Set
  8740.           Get Alternate Map Register Set subfunction
  8741.  
  8742.  
  8743.  
  8744.                If BL = 0
  8745.                    Indicates that a pointer to an area which contains the
  8746.                    state of all the map registers on all boards in the
  8747.                    system, and any additional information necessary to
  8748.                    restore the boards to their original state, has been
  8749.                    returned.
  8750.  
  8751.                ES:DI = pointer to a map register context save area
  8752.                    Contains a pointer to an operating system supplied
  8753.                    context save area.  The pointer is in standard seg-
  8754.                    ment:offset format.  This pointer is always returned if
  8755.                    the expanded memory hardware does not supply alternate
  8756.                    mapping register sets.
  8757.  
  8758.                    The operating system first passes this pointer to the
  8759.                    memory manager whenever it invokes a Set Alternate Map
  8760.                    Register Set subfunction (the description follows).  If
  8761.                    the OS/E invokes this function before invoking a Set
  8762.                    Alternate Map Register Set subfunction, this function
  8763.                    returns a pointer value of zero.  The OS/E must have
  8764.                    allocated the space for the save area.  However, the
  8765.                    memory manager must have initialized the contents of
  8766.                    this save area before it contains any useful informa-
  8767.                    tion.
  8768.  
  8769.                    The OS/E must initialize the save area it has allocated
  8770.                    by invoking Function 15 (Get Page Map subfunction). 
  8771.                    After the OS/E has done this, the save area will contain
  8772.                    the state of all the map registers on all boards in the
  8773.                    system.  The save area will also contain any additional
  8774.                    information necessary to restore the boards to their
  8775.                    original state when the operating system invokes a Set
  8776.                    Alternate Map Register Set subfunction.
  8777.  
  8778.  
  8779.           REGISTERS MODIFIED
  8780.  
  8781.                AX, BX, ES:DI
  8782.  
  8783.  
  8784.           STATUS
  8785.  
  8786.                AH = 0   SUCCESSFUL.
  8787.                    The manager got the alternate map register set.
  8788.  
  8789.  
  8790.  
  8791.  
  8792.           EMM Functions                                                 144
  8793.  
  8794.  
  8795.  
  8796.  
  8797.  
  8798.           Function 28. Alternate Map Register Set
  8799.           Get Alternate Map Register Set subfunction
  8800.  
  8801.  
  8802.  
  8803.                AH = 80h   NON-RECOVERABLE.
  8804.                    The manager detected a malfunction in the memory manager
  8805.                    software.
  8806.  
  8807.                AH = 81h   NON-RECOVERABLE.
  8808.                    The manager detected a malfunction in the expanded
  8809.                    memory hardware.
  8810.  
  8811.                AH = 84h   NON-RECOVERABLE.
  8812.                    The function code passed to the memory manager is not
  8813.                    defined.
  8814.  
  8815.                AH = 8Fh   NON-RECOVERABLE.
  8816.                    The subfunction parameter is invalid.
  8817.  
  8818.                AH = A4h   NON-RECOVERABLE.
  8819.                    The operating system denied access to this function. 
  8820.                    The function cannot be used at this time.
  8821.  
  8822.  
  8823.           EXAMPLE
  8824.  
  8825.           alt_map_reg_set                        DB ?
  8826.           context_save_area_ptr_seg              DW ?
  8827.           context_save_area_ptr_offset           DW ?
  8828.  
  8829.           MOV   AX,5B00h                         ; load function code
  8830.           INT   67h                              ; call the memory manager
  8831.           OR    AH,AH                            ; check EMM status
  8832.           JNZ   emm_err_handler                  ; jump to error handler
  8833.                                                  ; on error
  8834.           MOV   alt_map_reg_set,BL
  8835.           TEST  BL,BL
  8836.           JNZ   no_ptr_returned
  8837.  
  8838.           MOV   context_save_area_ptr_seg,ES     ; save pointer values
  8839.           MOV   context_save_area_ptr_offset,DI
  8840.  
  8841.           no_ptr_returned:
  8842.  
  8843.  
  8844.  
  8845.  
  8846.  
  8847.  
  8848.  
  8849.  
  8850.  
  8851.           EMM Functions                                                 145
  8852.  
  8853.  
  8854.  
  8855.  
  8856.  
  8857.           Function 28. Alternate Map Register Set
  8858.           Set Alternate Map Register Set subfunction
  8859.  
  8860.  
  8861.  
  8862.           Note............................................................
  8863.                This function is for use by operating systems only.  The
  8864.                operating system can disable this function at any time. 
  8865.                Refer to Function 30 for a description of how an operating
  8866.                system can enable or disable this function.
  8867.  
  8868.  
  8869.           PURPOSE
  8870.  
  8871.                The subfunction does one of two things, depending on the map
  8872.                register set specified:
  8873.  
  8874.                1.  If the alternate map register set specified is zero, map
  8875.                    register set zero is activated and the contents of the
  8876.                    map register context save area pointed to by ES:DI is
  8877.                    copied into register set zero on each expanded memory
  8878.                    board in the system.  The operating system must supply
  8879.                    the pointer to the area.  This subfunction is intended
  8880.                    to simulate setting an alternate map register set.  Note
  8881.                    that the operating system must allocate the space for
  8882.                    the context.
  8883.  
  8884.                2.  If the alternate map register set specified is not zero,
  8885.                    the alternate map register set specified is activated. 
  8886.                    The restore area, which the operating system is pointing
  8887.                    to, is not used.
  8888.  
  8889.  
  8890.           CALLING PARAMETERS
  8891.  
  8892.                AX = 5B01h
  8893.                    Contains the Set Alternate Map Register Set subfunction.
  8894.  
  8895.                BL = new alternate map register set number
  8896.                    Contains the number of the alternate map register set
  8897.                    which is to be activated.
  8898.  
  8899.                    If BL <> 0
  8900.                        A pointer to a map register context restore area is
  8901.                        not required and the contents of ES:DI is unaffected
  8902.                        and ignored.  The alternate map register set
  8903.                        specified in BL is activated, provided that the
  8904.                        board supports it.
  8905.  
  8906.  
  8907.  
  8908.  
  8909.  
  8910.           EMM Functions                                                 146
  8911.  
  8912.  
  8913.  
  8914.  
  8915.  
  8916.           Function 28. Alternate Map Register Set
  8917.           Set Alternate Map Register Set subfunction
  8918.  
  8919.  
  8920.  
  8921.                    If BL = 0
  8922.                        A pointer to an area which contains the state of all
  8923.                        the map registers on all boards in the system, and
  8924.                        any additional information necessary to restore the
  8925.                        boards to their original state, has been passed in
  8926.                        ES:DI.
  8927.  
  8928.                ES:DI = pointer to a map register context restore area
  8929.                    Contains a pointer to an OS/E supplied map register
  8930.                    context restore area.  The pointer is in standard
  8931.                    segment:offset format.  This pointer must always be
  8932.                    passed if the expanded memory hardware does not supply
  8933.                    alternate mapping register sets.
  8934.  
  8935.                    The memory manager must save this pointer whenever the
  8936.                    OS/E invokes this function.  The OS/E must have allo-
  8937.                    cated the space for the restore area.  Additionally, the
  8938.                    contents of this restore area must have been initialized
  8939.                    by the memory manager before it will contain any useful
  8940.                    information.  The OS/E initializes the restore area it
  8941.                    has allocated by invoking Function 15 (Get Page Map
  8942.                    subfunction).  After the OS/E has done this, the restore
  8943.                    area will contain the state of the map registers on all
  8944.                    boards in the system, and any additional information
  8945.                    necessary to restore the boards to their original state
  8946.                    when the operating system invokes a Set Alternate Map
  8947.                    Register Set subfunction.
  8948.  
  8949.  
  8950.           REGISTERS MODIFIED
  8951.  
  8952.                AX
  8953.  
  8954.  
  8955.           STATUS
  8956.  
  8957.                AH = 0   SUCCESSFUL.
  8958.                    The manager set the alternate map register set.
  8959.  
  8960.                AH = 80h   NON-RECOVERABLE.
  8961.                    The manager detected a malfunction in the memory manager
  8962.                    software.
  8963.  
  8964.                AH = 81h   NON-RECOVERABLE.
  8965.                    The manager detected a malfunction in the expanded
  8966.                    memory hardware.
  8967.  
  8968.  
  8969.           EMM Functions                                                 147
  8970.  
  8971.  
  8972.  
  8973.  
  8974.  
  8975.           Function 28. Alternate Map Register Set
  8976.           Set Alternate Map Register Set subfunction
  8977.  
  8978.  
  8979.  
  8980.                AH = 84h   NON-RECOVERABLE.
  8981.                    The function code passed to the memory manager is not
  8982.                    defined.
  8983.  
  8984.                AH = 8Fh   NON-RECOVERABLE.
  8985.                    The subfunction parameter is invalid.
  8986.  
  8987.                AH = 9Ah   NON-RECOVERABLE.
  8988.                    Alternate map register sets are supported, but the
  8989.                    alternate map register set specified is not supported.
  8990.  
  8991.                AH = 9Ch   NON-RECOVERABLE.
  8992.                    Alternate map register sets are not supported, and the
  8993.                    alternate map register set specified is not zero.
  8994.  
  8995.                AH = 9Dh   NON-RECOVERABLE.
  8996.                    Alternate map register sets are supported, but the
  8997.                    alternate map register set specified is either not
  8998.                    defined or not allocated.
  8999.  
  9000.                AH = A3h   NON-RECOVERABLE.
  9001.                    The contents of the source array have been corrupted, or
  9002.                    the pointer passed to the subfunction is invalid.
  9003.  
  9004.                AH = A4h   NON-RECOVERABLE.
  9005.                    The operating system has denied access to this function. 
  9006.                    The function cannot be used at this time.
  9007.  
  9008.  
  9009.  
  9010.  
  9011.  
  9012.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.  
  9018.  
  9019.  
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.  
  9026.  
  9027.  
  9028.           EMM Functions                                                 148
  9029.  
  9030.  
  9031.  
  9032.  
  9033.  
  9034.           Function 28. Alternate Map Register Set
  9035.           Set Alternate Map Register Set subfunction
  9036.  
  9037.  
  9038.  
  9039.           EXAMPLE
  9040.  
  9041.           alt_map_reg_set                        DB ?
  9042.           context_restore_area_ptr_seg           DW ?
  9043.           context_restore_area_ptr_offset        DW ?
  9044.  
  9045.           MOV   AX,5B01h                         ; load function code
  9046.           MOV   BL,alt_map_reg_set
  9047.           TEST  BL,BL
  9048.           JZ    no_ptr_passed
  9049.  
  9050.           MOV   ES,context_restore_area_ptr_seg
  9051.           MOV   DI,context_restore_area_ptr_offset
  9052.  
  9053.           no_ptr_passed:
  9054.  
  9055.           INT   67h                              ; call the memory manger
  9056.           OR    AH,AH                            ; check EMM status
  9057.           JNZ   emm_err_handler                  ; jump to error handler
  9058.                                                  ; on error
  9059.  
  9060.  
  9061.  
  9062.  
  9063.  
  9064.  
  9065.  
  9066.  
  9067.  
  9068.  
  9069.  
  9070.  
  9071.  
  9072.  
  9073.  
  9074.  
  9075.  
  9076.  
  9077.  
  9078.  
  9079.  
  9080.  
  9081.  
  9082.  
  9083.  
  9084.  
  9085.  
  9086.  
  9087.           EMM Functions                                                 149
  9088.  
  9089.  
  9090.  
  9091.  
  9092.  
  9093.           Function 28. Alternate Map Register Set
  9094.           Get Alternate Map Save Array Size subfunction
  9095.  
  9096.  
  9097.  
  9098.           Note............................................................
  9099.                This function is for use by operating systems only.  The
  9100.                operating system can disable this function at any time. 
  9101.                Refer to Function 30 for a description of how an operating
  9102.                system can enable or disable this function.
  9103.  
  9104.  
  9105.           PURPOSE
  9106.  
  9107.                This subfunction returns the storage requirements for the
  9108.                map register context save area referenced by the other
  9109.                subfunctions.
  9110.  
  9111.  
  9112.           CALLING PARAMETERS
  9113.  
  9114.                AX = 5B02h
  9115.                    Contains the Get Alternate Map Save Array Size subfunc-
  9116.                    tion.
  9117.  
  9118.  
  9119.           RESULTS
  9120.  
  9121.                These results are valid only if the status returned is zero.
  9122.  
  9123.                DX = size_of_array
  9124.                    Contains the number of bytes that will be transferred to
  9125.                    the memory area supplied by an operating system whenever
  9126.                    an operating system requests the Get, Set, or Get and
  9127.                    Set subfunction.
  9128.  
  9129.  
  9130.           REGISTERS MODIFIED
  9131.  
  9132.                AX, DX
  9133.  
  9134.  
  9135.           STATUS
  9136.  
  9137.                AH = 0   SUCCESSFUL.
  9138.                    The manager has returned the array size.
  9139.  
  9140.                AH = 80h   NON-RECOVERABLE.
  9141.                    The manager detected a malfunction in the memory manager
  9142.                    software.
  9143.  
  9144.  
  9145.  
  9146.           EMM Functions                                                 150
  9147.  
  9148.  
  9149.  
  9150.  
  9151.  
  9152.           Function 28. Alternate Map Register Set
  9153.           Get Alternate Map Save Array Size subfunction
  9154.  
  9155.  
  9156.  
  9157.                AH = 81h   NON-RECOVERABLE.
  9158.                    The manager detected a malfunction in the expanded
  9159.                    memory hardware.
  9160.  
  9161.                AH = 84h   NON-RECOVERABLE.
  9162.                    The function code passed to the memory manager is not
  9163.                    defined.
  9164.  
  9165.                AH = 8Fh   NON-RECOVERABLE.
  9166.                    The subfunction parameter is invalid.
  9167.  
  9168.                AH = A4h   NON-RECOVERABLE.
  9169.                    The operating system has denied access to this function. 
  9170.                    The function cannot be used at this time.
  9171.  
  9172.  
  9173.           EXAMPLE
  9174.  
  9175.           size_of_array                  DW ?
  9176.  
  9177.           MOV   AX,5B02h                 ; load function code
  9178.           INT   67h                      ; call the memory manager
  9179.           OR    AH,AH                    ; check EMM status
  9180.           JNZ   emm_err_handler          ; jump to error handler on error
  9181.           MOV   size_of_array,DX         ; save size of array
  9182.  
  9183.  
  9184.  
  9185.  
  9186.  
  9187.  
  9188.  
  9189.  
  9190.  
  9191.  
  9192.  
  9193.  
  9194.  
  9195.  
  9196.  
  9197.  
  9198.  
  9199.  
  9200.  
  9201.  
  9202.  
  9203.  
  9204.  
  9205.           EMM Functions                                                 151
  9206.  
  9207.  
  9208.  
  9209.  
  9210.  
  9211.           Function 28. Alternate Map Register Set
  9212.           Allocate Alternate Map Register Set subfunction
  9213.  
  9214.  
  9215.  
  9216.           Note............................................................
  9217.                This function is for use by operating systems only.  The
  9218.                operating system can disable this function at any time. 
  9219.                Refer to Function 30 for a description of how an operating
  9220.                system can enable or disable this function.
  9221.  
  9222.  
  9223.           PURPOSE
  9224.  
  9225.                The Allocate Alternate Map Register Set subfunction gets the
  9226.                number of an alternate map register set for an operating
  9227.                system if an alternate map register set is currently
  9228.                available for use.  If the hardware does not support
  9229.                alternate map register sets, an alternate map register set
  9230.                number of zero will be returned.
  9231.  
  9232.                The alternate map register set allocated may be referred to
  9233.                by this number when using the Get or Set Alternate Map
  9234.                Register Set subfunctions.  The operating system can use
  9235.                these subfunctions to switch map contexts very rapidly on
  9236.                expanded memory boards with alternate map register sets.
  9237.  
  9238.                This subfunction copies the currently active alternate map
  9239.                register set's contents into the newly allocated alternate
  9240.                map register set's mapping registers.  This is done so that
  9241.                when the OS/E performs a Set Alternate Map Register Set
  9242.                subfunction the memory mapped before the allocation of the
  9243.                new alternate map will be available for reading and writing. 
  9244.                This function does not actually change the alternate map
  9245.                register set in use, but in addition to allocating a new
  9246.                alternate map register set, it prepares the new alternate
  9247.                map register set for a subsequent Set Alternate Map Register
  9248.                Set subfunction.
  9249.  
  9250.  
  9251.           CALLING PARAMETERS
  9252.  
  9253.                AX = 5B03h
  9254.                    Contains the Allocate Alternate Map Register Set
  9255.                    subfunction.
  9256.  
  9257.  
  9258.  
  9259.  
  9260.  
  9261.  
  9262.  
  9263.  
  9264.           EMM Functions                                                 152
  9265.  
  9266.  
  9267.  
  9268.  
  9269.  
  9270.           Function 28. Alternate Map Register Set
  9271.           Allocate Alternate Map Register Set subfunction
  9272.  
  9273.  
  9274.  
  9275.           RESULTS
  9276.  
  9277.                These results are valid only if the status returned is zero.
  9278.  
  9279.                BL = alternate map register set number
  9280.                    Contains the number of an alternate map register set. 
  9281.                    If there are no alternate map register sets supported by
  9282.                    the hardware, a zero will be returned.  In this case,
  9283.                    the Get Alternate Map function (Function 28) should be
  9284.                    invoked in order to obtain a pointer to a map register
  9285.                    context save area.  The OS/E must supply this area.  The
  9286.                    save area is necessary because the hardware doesn't
  9287.                    support alternate map register sets.
  9288.  
  9289.  
  9290.           REGISTERS MODIFIED
  9291.  
  9292.                AX, BX
  9293.  
  9294.  
  9295.           STATUS
  9296.  
  9297.                AH = 0   SUCCESSFUL.
  9298.                    The manager has returned the alternate map register set
  9299.                    number.
  9300.  
  9301.                AH = 80h   NON-RECOVERABLE.
  9302.                    The manager detected a malfunction in the memory manager
  9303.                    software.
  9304.  
  9305.                AH = 81h   NON-RECOVERABLE.
  9306.                    The manager detected a malfunction in the expanded
  9307.                    memory hardware.
  9308.  
  9309.                AH = 84h   NON-RECOVERABLE.
  9310.                    The function code passed to the memory manager is not
  9311.                    defined.
  9312.  
  9313.                AH = 8Fh   NON-RECOVERABLE.
  9314.                    The subfunction parameter is invalid.
  9315.  
  9316.                AH = 9Bh   NON-RECOVERABLE.
  9317.                    Alternate map register sets are supported.  However, all
  9318.                    alternate map register sets are currently allocated.
  9319.  
  9320.  
  9321.  
  9322.  
  9323.           EMM Functions                                                 153
  9324.  
  9325.  
  9326.  
  9327.  
  9328.  
  9329.           Function 28. Alternate Map Register Set
  9330.           Allocate Alternate Map Register Set subfunction
  9331.  
  9332.  
  9333.  
  9334.                AH = A4h   NON-RECOVERABLE.
  9335.                    The operating system has denied access to this function. 
  9336.                    The function cannot be used at this time.
  9337.  
  9338.  
  9339.           EXAMPLE
  9340.  
  9341.           alt_map_reg_num                DB ?
  9342.  
  9343.           MOV   AX,5B03h                 ; load function code
  9344.           INT   67h                      ; call the memory manager
  9345.           OR    AH,AH                    ; check EMM status
  9346.           JNZ   emm_err_handler          ; jump to error handler on error
  9347.           MOV   alt_map_reg_num,BL       ; save number of
  9348.                                          ; alternate map register set
  9349.  
  9350.  
  9351.  
  9352.  
  9353.  
  9354.  
  9355.  
  9356.  
  9357.  
  9358.  
  9359.  
  9360.  
  9361.  
  9362.  
  9363.  
  9364.  
  9365.  
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377.  
  9378.  
  9379.  
  9380.  
  9381.  
  9382.           EMM Functions                                                 154
  9383.  
  9384.  
  9385.  
  9386.  
  9387.  
  9388.           Function 28. Alternate Map Register Set
  9389.           Deallocate Alternate Map Register Set subfunction
  9390.  
  9391.  
  9392.  
  9393.           Note............................................................
  9394.                This function is for use by operating systems only.  The
  9395.                operating system can disable this function at any time. 
  9396.                Refer to Function 30 for a description of how an operating
  9397.                system can enable or disable this function.
  9398.  
  9399.  
  9400.           PURPOSE
  9401.  
  9402.                The Deallocate Alternate Map Register Set subfunction
  9403.                returns the alternate map register set to the memory manager
  9404.                for future use.  The memory manager may reallocate the
  9405.                alternate map register set when needed.
  9406.  
  9407.                This subfunction also makes the mapping context of the
  9408.                alternate map register specified unavailable for reading or
  9409.                writing (unmapping).  This protects the pages previously
  9410.                mapped in an alternate map register set by making them
  9411.                inaccessible.  Note that the current alternate map register
  9412.                set cannot be deallocated.  This makes all memory which was
  9413.                currently mapped into conventional and expanded memory
  9414.                inaccessible.
  9415.  
  9416.  
  9417.           CALLING PARAMETERS
  9418.  
  9419.                AX = 5B04h
  9420.                    Contains the Deallocate Alternate Map Register Set
  9421.                    subfunction.
  9422.  
  9423.                BL = alternate register set number
  9424.                    Contains the number of the alternate map register set to
  9425.                    deallocate.  Map register set zero cannot be allocated
  9426.                    or deallocated.  However, if alternate map register set
  9427.                    zero is specified and this subfunction is invoked, no
  9428.                    error will be returned.  The function invocation is
  9429.                    ignored in this case.
  9430.  
  9431.  
  9432.           REGISTERS MODIFIED
  9433.  
  9434.                AX
  9435.  
  9436.  
  9437.  
  9438.  
  9439.  
  9440.  
  9441.           EMM Functions                                                 155
  9442.  
  9443.  
  9444.  
  9445.  
  9446.  
  9447.           Function 28. Alternate Map Register Set
  9448.           Deallocate Alternate Map Register Set subfunction
  9449.  
  9450.  
  9451.  
  9452.           STATUS
  9453.  
  9454.                AH = 0   SUCCESSFUL.
  9455.                    The manager has deallocated the alternate map register
  9456.                    set.
  9457.  
  9458.                AH = 80h   NON-RECOVERABLE.
  9459.                    The manager detected a malfunction in the memory manager
  9460.                    software.
  9461.  
  9462.                AH = 81h   NON-RECOVERABLE.
  9463.                    The manager detected a malfunction in the expanded
  9464.                    memory hardware.
  9465.  
  9466.                AH = 84h   NON-RECOVERABLE.
  9467.                    The function code passed to the memory manager is not
  9468.                    defined.
  9469.  
  9470.                AH = 8Fh   NON-RECOVERABLE.
  9471.                    The subfunction parameter is invalid.
  9472.  
  9473.                AH = 9Ch   NON-RECOVERABLE.
  9474.                    Alternate map register sets are not supported and the
  9475.                    alternate map register set specified is not zero.
  9476.  
  9477.                AH = 9Dh   NON-RECOVERABLE.
  9478.                    Alternate map register sets are supported, but the
  9479.                    alternate map register set specified is either not
  9480.                    defined or not allocated.
  9481.  
  9482.                AH = A4h   NON-RECOVERABLE.
  9483.                    The operating system has denied access to this function. 
  9484.                    The function cannot be used at this time.
  9485.  
  9486.  
  9487.           EXAMPLE
  9488.  
  9489.           alternate_map_reg_set               DB ?
  9490.  
  9491.           MOV   BL,alternate_map_reg_set      ; specify alternate map
  9492.                                               ; register set
  9493.           MOV   AX,5B04h                      ; load function code
  9494.           INT   67h                           ; call the memory manager
  9495.           OR    AH,AH                         ; check EMM status
  9496.           JNZ   emm_err_handler               ; jump to error handler
  9497.                                               ; on error
  9498.  
  9499.  
  9500.           EMM Functions                                                 156
  9501.  
  9502.  
  9503.  
  9504.  
  9505.  
  9506.           Function 28. Alternate Map Register Set
  9507.           Allocate DMA Register Set subfunction
  9508.  
  9509.  
  9510.  
  9511.           Note............................................................
  9512.                This function is for use by operating systems only.  The
  9513.                operating system can disable this function at any time. 
  9514.                Refer to Function 30 for a description of how an operating
  9515.                system can enable or disable this function.
  9516.  
  9517.  
  9518.           PURPOSE
  9519.  
  9520.                The Allocate DMA Register Set subfunction gets the number of
  9521.                a DMA register set for an OS/E, if a DMA register set is
  9522.                currently available for use.  If the hardware does not
  9523.                support DMA register sets, a DMA register set number of zero
  9524.                will be returned.
  9525.  
  9526.                In a multitasking operating system, when one task is waiting
  9527.                for DMA to complete, it is useful to be able to switch to
  9528.                another task.  However, if the DMA is being mapped through
  9529.                the current register set, the switching cannot occur.  That
  9530.                is, all DMA action must be complete before any remapping of
  9531.                pages can be done.
  9532.  
  9533.                The operating system would initiate a DMA operation on a
  9534.                specific DMA channel using a specific alternate map register
  9535.                set.  This alternate map register set would not be used
  9536.                again, by the operating system or an application, until
  9537.                after the DMA operation is complete.  The operating system
  9538.                guarantees this by not changing the contents of the alter-
  9539.                nate map register set, or allowing an application to change
  9540.                the contents of the alternate map register set, for the
  9541.                duration of the DMA operation.
  9542.  
  9543.  
  9544.           CALLING PARAMETERS
  9545.  
  9546.                AX = 5B05h
  9547.                    Contains the Allocate DMA Register Set subfunction.
  9548.  
  9549.  
  9550.           RESULTS
  9551.  
  9552.                These results are valid only if the status returned is zero.
  9553.  
  9554.                BL = DMA register set number
  9555.                    Contains the number of a DMA register set.  If there are
  9556.                    no DMA register sets supported by the hardware, a zero
  9557.                    will be returned.
  9558.  
  9559.           EMM Functions                                                 157
  9560.  
  9561.  
  9562.  
  9563.  
  9564.  
  9565.           Function 28. Alternate Map Register Set
  9566.           Allocate DMA Register Set subfunction
  9567.  
  9568.  
  9569.  
  9570.           REGISTERS MODIFIED
  9571.  
  9572.                AX, BX
  9573.  
  9574.  
  9575.           STATUS
  9576.  
  9577.                AH = 0   SUCCESSFUL.
  9578.                    The manager has allocated the DMA register set.
  9579.  
  9580.                AH = 80h   NON-RECOVERABLE.
  9581.                    The manager detected a malfunction in the memory manager
  9582.                    software.
  9583.  
  9584.                AH = 81h   NON-RECOVERABLE.
  9585.                    The manager detected a malfunction in the expanded
  9586.                    memory hardware.
  9587.  
  9588.                AH = 84h   NON-RECOVERABLE.
  9589.                    The function code passed to the memory manager is not
  9590.                    defined.
  9591.  
  9592.                AH = 8Fh   NON-RECOVERABLE.
  9593.                    The subfunction parameter is invalid.
  9594.  
  9595.                AH = 9Bh   NON-RECOVERABLE.
  9596.                    DMA register sets are supported.  However, all DMA
  9597.                    register sets are currently allocated.
  9598.  
  9599.                AH = A4h   NON-RECOVERABLE.
  9600.                    Access to this function has been denied by the operating
  9601.                    system.  The function cannot be used at this time.
  9602.  
  9603.  
  9604.           EXAMPLE
  9605.  
  9606.           DMA_reg_set_number                  DB ?
  9607.  
  9608.           MOV   AX,5B05h                      ; load function code
  9609.           INT   67h                           ; call memory manager
  9610.           OR    AH,AH                         ; check EMM status
  9611.           JNZ   emm_err_handler               ; jump to error handler
  9612.                                               ; on error
  9613.           MOV   DMA_reg_set_number,BL         ; save number of DMA
  9614.                                               ; register set
  9615.  
  9616.  
  9617.  
  9618.           EMM Functions                                                 158
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.           Function 28. Alternate Map Register Set
  9625.           Enable DMA on Alternate Map Register Set subfunction
  9626.  
  9627.  
  9628.  
  9629.           Note............................................................
  9630.                This function is for use by operating systems only.  The
  9631.                operating system can disable this function at any time. 
  9632.                Refer to Function 30 for a description of how an operating
  9633.                system can enable or disable this function.
  9634.  
  9635.  
  9636.           PURPOSE
  9637.  
  9638.                This subfunction allows DMA accesses on a specific DMA
  9639.                channel to be associated with a specific alternate map
  9640.                register set.  In a multitasking operating system, when a
  9641.                task is waiting for the completion of DMA, it is useful to
  9642.                be able to switch to another task until the DMA operation
  9643.                completes.
  9644.  
  9645.                Any DMA on the specified channel will go through the speci-
  9646.                fied DMA register set regardless of the current register
  9647.                set.  If a DMA channel is not assigned to a DMA register
  9648.                set, DMA for that channel will be mapped through the current
  9649.                register set.
  9650.  
  9651.  
  9652.           CALLING PARAMETERS
  9653.  
  9654.                AX = 5B06h
  9655.                    Contains the Enable DMA on Alternate Map Register Set
  9656.                    subfunction.
  9657.  
  9658.                BL = DMA register set number
  9659.                    Contains the number of the alternate map register set to
  9660.                    be used for DMA operations on the DMA channel specified
  9661.                    by DL.  If the alternate map register set specified is
  9662.                    zero, no special action will be taken on DMA accesses
  9663.                    for the DMA channel specified.
  9664.  
  9665.                DL = DMA channel number
  9666.                    Contains the DMA channel which is to be associated with
  9667.                    the DMA map register set specified in BL.
  9668.  
  9669.  
  9670.           REGISTERS MODIFIED
  9671.  
  9672.                AX
  9673.  
  9674.  
  9675.  
  9676.  
  9677.           EMM Functions                                                 159
  9678.  
  9679.  
  9680.  
  9681.  
  9682.  
  9683.           Function 28. Alternate Map Register Set
  9684.           Enable DMA on Alternate Map Register Set subfunction
  9685.  
  9686.  
  9687.  
  9688.           STATUS
  9689.  
  9690.                AH = 0   SUCCESSFUL.
  9691.                    The manager has enabled DMA on the DMA register set and
  9692.                    the DMA channel specified.
  9693.  
  9694.                AH = 80h   NON-RECOVERABLE.
  9695.                    The manager detected a malfunction in the memory manager
  9696.                    software.
  9697.  
  9698.                AH = 81h   NON-RECOVERABLE.
  9699.                    The manager detected a malfunction in the expanded
  9700.                    memory hardware.
  9701.  
  9702.                AH = 84h   NON-RECOVERABLE.
  9703.                    The function code passed to the memory manager is not
  9704.                    defined.
  9705.  
  9706.                AH = 8Fh   NON-RECOVERABLE.
  9707.                    The subfunction parameter is invalid.
  9708.  
  9709.                AH = 9Ah   NON-RECOVERABLE.
  9710.                    Alternate DMA register sets are supported, but the
  9711.                    alternate DMA register set specified is not supported.
  9712.  
  9713.                AH = 9Ch   NON-RECOVERABLE.
  9714.                    Alternate DMA register sets are not supported, and the
  9715.                    DMA register set specified is not zero.
  9716.  
  9717.                AH = 9Dh   NON-RECOVERABLE.
  9718.                    DMA register sets are supported, but the DMA register
  9719.                    set specified is either not defined or not allocated.
  9720.  
  9721.                AH = 9Eh   NON-RECOVERABLE.
  9722.                    Dedicated DMA channels are not supported.
  9723.  
  9724.                AH = 9Fh   NON-RECOVERABLE.
  9725.                    Dedicated DMA channels are supported, but the DMA
  9726.                    channel specified is not supported.
  9727.  
  9728.                AH = A4h   NON-RECOVERABLE.
  9729.                    The operating system has denied access to this function. 
  9730.                    The function cannot be used at this time.
  9731.  
  9732.  
  9733.  
  9734.  
  9735.  
  9736.           EMM Functions                                                 160
  9737.  
  9738.  
  9739.  
  9740.  
  9741.  
  9742.           Function 28. Alternate Map Register Set
  9743.           Enable DMA on Alternate Map Register Set subfunction
  9744.  
  9745.  
  9746.  
  9747.           EXAMPLE
  9748.  
  9749.           alt_map_reg_set                DB ?
  9750.           DMA_channel_num                DB ?
  9751.  
  9752.           MOV   BL,alt_map_reg_set
  9753.           MOV   DL,DMA_channel_num
  9754.           MOV   AX,5B06h                 ; load function code
  9755.           INT   67h                      ; call the memory manager
  9756.           OR    AH,AH                    ; check EMM status
  9757.           JNZ   emm_err_handler          ; jump to error handler on error
  9758.  
  9759.  
  9760.  
  9761.  
  9762.  
  9763.  
  9764.  
  9765.  
  9766.  
  9767.  
  9768.  
  9769.  
  9770.  
  9771.  
  9772.  
  9773.  
  9774.  
  9775.  
  9776.  
  9777.  
  9778.  
  9779.  
  9780.  
  9781.  
  9782.  
  9783.  
  9784.  
  9785.  
  9786.  
  9787.  
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.  
  9794.  
  9795.           EMM Functions                                                 161
  9796.  
  9797.  
  9798.  
  9799.  
  9800.  
  9801.           Function 28. Alternate Map Register Set
  9802.           Disable DMA on Alternate Map Register Set subfunction
  9803.  
  9804.  
  9805.  
  9806.           Note............................................................
  9807.                This function is for use by operating systems only.  The
  9808.                operating system can disable this function at any time. 
  9809.                Refer to Function 30 for a description of how an operating
  9810.                system can enable or disable this function.
  9811.  
  9812.  
  9813.           PURPOSE
  9814.  
  9815.                This subfunction disables DMA accesses for all DMA channels
  9816.                which were associated with a specific alternate map register
  9817.                set.
  9818.  
  9819.  
  9820.           CALLING PARAMETERS
  9821.  
  9822.                AX = 5B07h
  9823.                    Contains the Disable DMA on Alternate Map Register Set
  9824.                    subfunction.
  9825.  
  9826.                BL = alternate register set number
  9827.                    Contains the number of the DMA register set for which
  9828.                    all operations are to be disabled.  If the alternate map
  9829.                    register set specified is zero, no action will be taken.
  9830.  
  9831.  
  9832.           REGISTERS MODIFIED
  9833.  
  9834.                AX
  9835.  
  9836.  
  9837.           STATUS
  9838.  
  9839.                AH = 0   SUCCESSFUL.
  9840.                    The manager has disabled DMA operations on the alternate
  9841.                    DMA register set.
  9842.  
  9843.                AH = 80h   NON-RECOVERABLE.
  9844.                    The manager detected a malfunction in the memory manager
  9845.                    software.
  9846.  
  9847.                AH = 81h   NON-RECOVERABLE.
  9848.                    The manager detected a malfunction in the expanded
  9849.                    memory hardware.
  9850.  
  9851.  
  9852.  
  9853.  
  9854.           EMM Functions                                                 162
  9855.  
  9856.  
  9857.  
  9858.  
  9859.  
  9860.           Function 28. Alternate Map Register Set
  9861.           Disable DMA on Alternate Map Register Set subfunction
  9862.  
  9863.  
  9864.  
  9865.                AH = 84h   NON-RECOVERABLE.
  9866.                    The function code passed to the memory manager is not
  9867.                    defined.
  9868.  
  9869.                AH = 8Fh   NON-RECOVERABLE.
  9870.                    The subfunction parameter is invalid.
  9871.  
  9872.                AH = 9Ah   NON-RECOVERABLE.
  9873.                    Alternate DMA register sets are supported, but the
  9874.                    alternate DMA register set specified is not supported.
  9875.  
  9876.                AH = 9Ch   NON-RECOVERABLE.
  9877.                    Alternate DMA register sets are not supported, and the
  9878.                    DMA register set specified is not zero.
  9879.  
  9880.                AH = 9Dh   NON-RECOVERABLE.
  9881.                    DMA register sets are supported, but the DMA register
  9882.                    set specified is either not defined or not allocated.
  9883.  
  9884.                AH = 9Eh   NON-RECOVERABLE.
  9885.                    Dedicated DMA channels are not supported.
  9886.  
  9887.                AH = 9Fh   NON-RECOVERABLE.
  9888.                    Dedicated DMA channels are supported, but the DMA
  9889.                    channel specified is not supported.
  9890.  
  9891.                AH = A4h   NON-RECOVERABLE.
  9892.                    The operating system has denied access to this function. 
  9893.                    The function cannot be used at this time.
  9894.  
  9895.  
  9896.           EXAMPLE
  9897.  
  9898.           DMA_reg_set                    DB ?
  9899.  
  9900.           MOV   BL,DMA_reg_set
  9901.           MOV   AX,5B07h                 ; load function code
  9902.           INT   67h                      ; call the memory manager
  9903.           OR    AH,AH                    ; check EMM status
  9904.           JNZ   emm_err_handler          ; jump to error handler on error
  9905.  
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.  
  9912.  
  9913.           EMM Functions                                                 163
  9914.  
  9915.  
  9916.  
  9917.  
  9918.  
  9919.           Function 28. Alternate Map Register Set
  9920.           Deallocate DMA Register Set subfunction
  9921.  
  9922.  
  9923.  
  9924.           Note............................................................
  9925.                This function is for use by operating systems only.  The
  9926.                operating system can disable this function at any time. 
  9927.                Refer to Function 30 for a description of how an operating
  9928.                system can enable or disable this function.
  9929.  
  9930.  
  9931.           PURPOSE
  9932.  
  9933.                The Deallocate DMA Register Set subfunction deallocates the
  9934.                specified DMA register set.
  9935.  
  9936.  
  9937.           CALLING PARAMETERS
  9938.  
  9939.                AX = 5B08h
  9940.                    Contains the Deallocate DMA Register Set subfunction.
  9941.  
  9942.                BL = DMA register set number
  9943.                    Contains the number of the DMA register set which should
  9944.                    not be used for DMA operations any longer.  The DMA
  9945.                    register set would have been previously allocated and
  9946.                    enabled for DMA operations on a specific DMA channel. 
  9947.                    If the DMA register set specified is zero, no action
  9948.                    will be taken.
  9949.  
  9950.  
  9951.           REGISTERS MODIFIED
  9952.  
  9953.                AX
  9954.  
  9955.  
  9956.           STATUS
  9957.  
  9958.                AH = 0   SUCCESSFUL.
  9959.                    The manager has deallocated the DMA register set.
  9960.  
  9961.                AH = 80h   NON-RECOVERABLE.
  9962.                    The manager detected a malfunction in the memory manager
  9963.                    software.
  9964.  
  9965.                AH = 81h   NON-RECOVERABLE.
  9966.                    The manager detected a malfunction in the expanded
  9967.                    memory hardware.
  9968.  
  9969.  
  9970.  
  9971.  
  9972.           EMM Functions                                                 164
  9973.  
  9974.  
  9975.  
  9976.  
  9977.  
  9978.           Function 28. Alternate Map Register Set
  9979.           Deallocate DMA on Alternate Map Register Set subfunction
  9980.  
  9981.  
  9982.  
  9983.                AH = 84h   NON-RECOVERABLE.
  9984.                    The function code passed to the memory manager is not
  9985.                    defined.
  9986.  
  9987.                AH = 8Fh   NON-RECOVERABLE.
  9988.                    The subfunction parameter is invalid.
  9989.  
  9990.                AH = 9Ch   NON-RECOVERABLE.
  9991.                    DMA register sets are not supported, and the DMA
  9992.                    register set specified is not zero.
  9993.  
  9994.                AH = 9Dh   NON-RECOVERABLE.
  9995.                    DMA register sets are supported, but the DMA register
  9996.                    set specified is either not defined or not allocated.
  9997.  
  9998.                AH = A4h   NON-RECOVERABLE.
  9999.                    The operating system has denied access to this function. 
  10000.                    The function cannot be used at this time.
  10001.  
  10002.  
  10003.           EXAMPLE
  10004.  
  10005.           DMA_reg_set_num                DB ?
  10006.  
  10007.           MOV   BL,DMA_reg_set_num
  10008.           MOV   AX,5B08h                 ; load function code
  10009.           INT   67h                      ; call the memory manager
  10010.           OR    AH,AH                    ; check EMM status
  10011.           JNZ   emm_err_handler          ; jump to error handler on error
  10012.  
  10013.  
  10014.  
  10015.  
  10016.  
  10017.  
  10018.  
  10019.  
  10020.  
  10021.  
  10022.  
  10023.  
  10024.  
  10025.  
  10026.  
  10027.  
  10028.  
  10029.  
  10030.  
  10031.           EMM Functions                                                 165
  10032.  
  10033.  
  10034.  
  10035.  
  10036.  
  10037.           Function 29. Prepare Expanded Memory Hardware For Warm Boot
  10038.  
  10039.  
  10040.  
  10041.           PURPOSE
  10042.  
  10043.                This function prepares the expanded memory hardware for an
  10044.                impending warm boot.  This function assumes that the next
  10045.                operation that the operating system performs is a warm boot
  10046.                of the system.  In general, this function will effect the
  10047.                current mapping context, the alternate register set in use,
  10048.                and any other expanded memory hardware dependencies which
  10049.                need to be initialized at boot time.  If an application
  10050.                decides to map memory below 640K, the application must trap
  10051.                all possible conditions leading to a warm boot and invoke
  10052.                this function before performing the warm boot itself.
  10053.  
  10054.  
  10055.           CALLING PARAMETERS
  10056.  
  10057.                AH = 5Ch
  10058.                    Contains the Prepare Expanded Memory Hardware for
  10059.                    Warmboot function.
  10060.  
  10061.  
  10062.           REGISTERS MODIFIED
  10063.  
  10064.                AX
  10065.  
  10066.  
  10067.           STATUS
  10068.  
  10069.                AH = 0   SUCCESSFUL.
  10070.                    The manager has prepared the expanded memory hardware
  10071.                    for a warm boot.
  10072.  
  10073.                AH = 80h   NON-RECOVERABLE.
  10074.                    The manager detected a malfunction in the memory manager
  10075.                    software.
  10076.  
  10077.                AH = 81h   NON-RECOVERABLE.
  10078.                    The manager detected a malfunction in the expanded
  10079.                    memory hardware.
  10080.  
  10081.                AH = 84h   NON-RECOVERABLE.
  10082.                    The function code passed to the memory manager is not
  10083.                    defined.
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.           EMM Functions                                                 166
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.           Function 29. Prepare Expanded Memory Hardware for Warm Boot
  10097.  
  10098.  
  10099.  
  10100.           EXAMPLE
  10101.  
  10102.           MOV   AH,5Ch                   ; load function code
  10103.           INT   67h                      ; call the memory manager
  10104.           OR    AH,AH                    ; check EMM status
  10105.           JNZ   emm_err_handler          ; jump to error handler on error
  10106.  
  10107.  
  10108.  
  10109.  
  10110.  
  10111.  
  10112.  
  10113.  
  10114.  
  10115.  
  10116.  
  10117.  
  10118.  
  10119.  
  10120.  
  10121.  
  10122.  
  10123.  
  10124.  
  10125.  
  10126.  
  10127.  
  10128.  
  10129.  
  10130.  
  10131.  
  10132.  
  10133.  
  10134.  
  10135.  
  10136.  
  10137.  
  10138.  
  10139.  
  10140.  
  10141.  
  10142.  
  10143.  
  10144.  
  10145.  
  10146.  
  10147.  
  10148.  
  10149.           EMM Functions                                                 167
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.           Function 30. Enable/Disable OS/E Function Set Functions
  10156.           Enable OS/E Function Set subfunction
  10157.  
  10158.  
  10159.  
  10160.           Note............................................................
  10161.                This function is for use by operating systems only.  The
  10162.                operating system can disable this function at any time.
  10163.  
  10164.  
  10165.           PURPOSE
  10166.  
  10167.                This subfunction provides an OS/E with the ability to enable
  10168.                all programs or device drivers to use the OS/E specific
  10169.                functions.  The capability is provided only for an OS/E
  10170.                which manages regions of mappable conventional memory and
  10171.                cannot permit programs to use any of the functions which
  10172.                affect mappable conventional memory regions, but must be
  10173.                able to use these functions itself.  When an OS/E disables
  10174.                these functions and a program attempts to use them, the
  10175.                memory manager returns a status to the program indicating
  10176.                that the OS/E has denied the program access to the function. 
  10177.                In other words, the functions will not work when disabled. 
  10178.                However, all programs may use them when enabled.
  10179.  
  10180.                The OS/E (Operating System/Environment) functions this
  10181.                subfunction enables are:
  10182.  
  10183.                Function 26.  Get Expanded Memory Hardware Information.
  10184.                Function 28.  Alternate Map Register Sets.
  10185.                Function 30.  Enable/Disable Operating System Functions.
  10186.  
  10187.                It appears contradictory that the OS/E can re-enable these
  10188.                functions when the function which re-enables them is itself
  10189.                disabled.  An overview of the process follows:
  10190.  
  10191.                The memory manager enables all the OS/E specific functions,
  10192.                including this one, when it is loaded.  The OS/E gets
  10193.                exclusive access to these functions by invoking either of
  10194.                the Enable/Disable OS/E Function Set subfunctions before any
  10195.                other software does.
  10196.  
  10197.                On the first invocation of either of these subfunctions, the
  10198.                memory manager returns an access_key which the OS/E must use
  10199.                in all future invocations of either of these subfunctions. 
  10200.                The memory manager does not require the access_key on the
  10201.                first invocation of the Enable/Disable OS/E Function Set
  10202.                subfunctions.
  10203.  
  10204.  
  10205.  
  10206.  
  10207.  
  10208.           EMM Functions                                                 168
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.           Function 30. Enable/Disable OS/E Function Set Functions
  10215.           Enable OS/E Function Set subfunction
  10216.  
  10217.  
  10218.  
  10219.                On all subsequent invocations, the access_key is required
  10220.                for either the Enable or Disable OS/E Function Set subfunc-
  10221.                tions.  Since the access_key is returned only on the first
  10222.                invocation of the Enable/Disable OS/E Function Set subfunc-
  10223.                tions, and presumably the OS/E is the first software to
  10224.                invoke this function, only the OS/E obtains a copy of this
  10225.                key.  The memory manager must return an access key with a
  10226.                random value, a fixed value key defeats the purpose of
  10227.                providing this level of security for an OS/E.
  10228.  
  10229.  
  10230.           CALLING PARAMETERS
  10231.  
  10232.                AX = 5D00h
  10233.                    Contains the Enable OS/E Function Set subfunction.
  10234.  
  10235.                BX,CX = access_key
  10236.                    Required on all function invocations after the first. 
  10237.                    The access_key value returned by the first function
  10238.                    invocation is required.
  10239.  
  10240.  
  10241.           RESULTS
  10242.  
  10243.                These results are valid only if the status returned is zero.
  10244.  
  10245.                BX,CX = access_key
  10246.                    Returned only on the first function invocation, the
  10247.                    memory manager returns a random valued key which will be
  10248.                    required thereafter for the execution of this function. 
  10249.                    On all invocations after the first, this key is not
  10250.                    returned.  Neither BX nor CX is affected after the first
  10251.                    time this function is invoked.
  10252.  
  10253.  
  10254.           REGISTERS MODIFIED
  10255.  
  10256.                AX, BX, CX
  10257.  
  10258.  
  10259.           STATUS
  10260.  
  10261.                AH = 0   SUCCESSFUL.
  10262.                    The operating system function set has been enabled.
  10263.  
  10264.  
  10265.  
  10266.  
  10267.           EMM Functions                                                 169
  10268.  
  10269.  
  10270.  
  10271.  
  10272.  
  10273.           Function 30. Enable/Disable OS/E Function Set Functions
  10274.           Enable OS/E Function Set subfunction
  10275.  
  10276.  
  10277.  
  10278.                AH = 80h   NON-RECOVERABLE.
  10279.                    The manager detected a malfunction in the memory manager
  10280.                    software.
  10281.  
  10282.                AH = 81h   NON-RECOVERABLE.
  10283.                    The manager detected a malfunction in the expanded
  10284.                    memory hardware.
  10285.  
  10286.                AH = 84h   NON-RECOVERABLE.
  10287.                    The function code passed to the memory manager is not
  10288.                    defined.
  10289.  
  10290.                AH = 8Fh   NON-RECOVERABLE.
  10291.                    The subfunction parameter is invalid.
  10292.  
  10293.                AH = A4h   NON-RECOVERABLE.
  10294.                    The operating system has denied access to this function. 
  10295.                    The function cannot be used at this time.  The value of
  10296.                    the key which was passed to this function does not
  10297.                    entitle the program to execute this function.
  10298.  
  10299.  
  10300.           EXAMPLE
  10301.  
  10302.           First invocation
  10303.  
  10304.           access_key                     DW 2 DUP (?)
  10305.  
  10306.           MOV   AX,5D00h                 ; load function code
  10307.           INT   67h                      ; call the memory manager
  10308.           OR    AH,AH                    ; check EMM status
  10309.           JNZ   emm_err_handler          ; jump to error handler on error
  10310.           MOV   access_key[0],BX
  10311.           MOV   access_key[2],CX
  10312.  
  10313.  
  10314.           All invocations after the first
  10315.  
  10316.           access_key                     DW 2 DUP (?)
  10317.  
  10318.           MOV   BX,access_key[0]
  10319.           MOV   CX,access_key[2]
  10320.           MOV   AX,5D00h                 ; load function code
  10321.           INT   67h                      ; call the memory manager
  10322.           OR    AH,AH                    ; check EMM status
  10323.           JNZ   emm_err_handler          ; jump to error handler on error
  10324.  
  10325.  
  10326.           EMM Functions                                                 170
  10327.  
  10328.  
  10329.  
  10330.  
  10331.  
  10332.           Function 30. Enable/Disable OS/E Function Set Functions
  10333.           Disable OS/E Function Set subfunction
  10334.  
  10335.  
  10336.  
  10337.           Note............................................................
  10338.                This function is for use by operating systems only.  The
  10339.                operating system can disable this function at any time.
  10340.  
  10341.  
  10342.           PURPOSE
  10343.  
  10344.                This subfunction provides an OS/E with the ability to
  10345.                disable all programs or device drivers from using the OS/E
  10346.                specific functions.  The capability is provided only for an
  10347.                OS/E which manages regions of mappable conventional memory
  10348.                and cannot permit programs to use any of the functions which
  10349.                would affect mappable conventional memory regions.  When an
  10350.                OS/E disables these functions and a program attempts to use
  10351.                them, the memory manager returns a status to the program
  10352.                indicating that the OS/E has denied the program access to
  10353.                the function.  In other words, the functions will not work
  10354.                when disabled.
  10355.  
  10356.                The OS/E (Operating System) functions which are disabled by
  10357.                this subfunction are:
  10358.  
  10359.                Function 26.  Get Expanded Memory Hardware Information.
  10360.                Function 28.  Alternate Map Register Sets.
  10361.                Function 30.  Enable/Disable Operating System Functions.
  10362.  
  10363.  
  10364.           CALLING PARAMETERS
  10365.  
  10366.                AX = 5D01h
  10367.                    Contains the Disable OS/E Function Set subfunction.
  10368.  
  10369.                BX,CX = access_key
  10370.                    Required on all function invocations after the first. 
  10371.                    The access_key value returned by the first function
  10372.                    invocation is required.
  10373.  
  10374.  
  10375.  
  10376.  
  10377.  
  10378.  
  10379.  
  10380.  
  10381.  
  10382.  
  10383.  
  10384.  
  10385.           EMM Functions                                                 171
  10386.  
  10387.  
  10388.  
  10389.  
  10390.  
  10391.           Function 30. Enable/Disable OS/E Function Set Functions
  10392.           Disable OS/E Function Set subfunction
  10393.  
  10394.  
  10395.  
  10396.           RESULTS
  10397.  
  10398.                These results are valid only if the status returned is zero.
  10399.  
  10400.                BX,CX = access_key
  10401.                    Returned only on the first function invocation, the
  10402.                    memory manager returns a random valued key which will be
  10403.                    required thereafter for the execution of this function. 
  10404.                    On all invocations after the first, this key is not
  10405.                    returned.  Neither BX nor CX is affected after the first
  10406.                    time this function is invoked.
  10407.  
  10408.  
  10409.           REGISTERS MODIFIED
  10410.  
  10411.                AX, BX, CX
  10412.  
  10413.  
  10414.           STATUS
  10415.  
  10416.                AH = 0   SUCCESSFUL.
  10417.                    The operating system function set has been disabled.
  10418.  
  10419.                AH = 80h   NON-RECOVERABLE.
  10420.                    The manager detected a malfunction in the memory manager
  10421.                    software.
  10422.  
  10423.                AH = 81h   NON-RECOVERABLE.
  10424.                    The manager detected a malfunction in the expanded
  10425.                    memory hardware.
  10426.  
  10427.                AH = 84h   NON-RECOVERABLE.
  10428.                    The function code passed to the memory manager is not
  10429.                    defined.
  10430.  
  10431.                AH = 8Fh   NON-RECOVERABLE.
  10432.                    The subfunction parameter is invalid.
  10433.  
  10434.                AH = A4h   NON-RECOVERABLE.
  10435.                    The operating system has denied access to this function. 
  10436.                    The function cannot be used at this time.  The value of
  10437.                    the key which was passed to this function does not
  10438.                    entitle the program to execute this function.
  10439.  
  10440.  
  10441.  
  10442.  
  10443.  
  10444.           EMM Functions                                                 172
  10445.  
  10446.  
  10447.  
  10448.  
  10449.  
  10450.           Function 30. Enable/Disable OS/E Function Set Functions
  10451.           Disable OS/E Function Set subfunction
  10452.  
  10453.  
  10454.  
  10455.           EXAMPLE
  10456.  
  10457.           First invocation
  10458.  
  10459.           access_key                     DW 2 DUP (?)
  10460.  
  10461.           MOV   AX,5D01h                 ; load function code
  10462.           INT   67h                      ; call the memory manager
  10463.           OR    AH,AH                    ; check EMM status
  10464.           JNZ   emm_err_handler          ; jump to error handler on error
  10465.           MOV   access_key[0],BX
  10466.           MOV   access_key[2],CX
  10467.  
  10468.  
  10469.           All invocations after the first
  10470.  
  10471.           access_key                     DW 2 DUP (?)
  10472.  
  10473.           MOV   BX,access_key[0]
  10474.           MOV   CX,access_key[2]
  10475.           MOV   AX,5D01h                 ; load function code
  10476.           INT   67h                      ; call the memory manager
  10477.           OR    AH,AH                    ; check EMM status
  10478.           JNZ   emm_err_handler          ; jump to error handler on error
  10479.  
  10480.  
  10481.  
  10482.  
  10483.  
  10484.  
  10485.  
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.  
  10493.  
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.  
  10500.  
  10501.  
  10502.  
  10503.           EMM Functions                                                 173
  10504.  
  10505.  
  10506.  
  10507.  
  10508.  
  10509.           Function 30. Enable/Disable OS/E Function Set Functions
  10510.           Return Access Key subfunction
  10511.  
  10512.  
  10513.  
  10514.           Note............................................................
  10515.                This function is for use by operating systems only.  The
  10516.                operating system can disable this function at any time.
  10517.  
  10518.  
  10519.           PURPOSE
  10520.  
  10521.                This subfunction provides an OS/E with the ability to return
  10522.                the access key to the memory manager.  Returning the access
  10523.                key to the memory manager places the memory manager in the
  10524.                state it is in at installation time (regarding the use of
  10525.                the OS/E function set and the access key).  That is, access
  10526.                to the OS/E function set is enabled.  Upon execution of the
  10527.                next enable/disable OS/E function set subfunction, the
  10528.                access key will once again be returned.
  10529.  
  10530.  
  10531.           CALLING PARAMETERS
  10532.  
  10533.                AX = 5D02h
  10534.                    Contains the Return Access Key subfunction.
  10535.  
  10536.                BX,CX = access_key
  10537.                    Required on all function invocations.  The access_key
  10538.                    value returned by the first function invocation of the
  10539.                    enable or disable subfunctions is required.
  10540.  
  10541.  
  10542.           REGISTERS MODIFIED
  10543.  
  10544.                AX
  10545.  
  10546.  
  10547.           STATUS
  10548.  
  10549.                AH = 0   SUCCESSFUL.
  10550.                    The access key has been returned to the memory manager.
  10551.  
  10552.                AH = 80h   NON-RECOVERABLE.
  10553.                    The manager detected a malfunction in the memory manager
  10554.                    software.
  10555.  
  10556.                AH = 81h   NON-RECOVERABLE.
  10557.                    The manager detected a malfunction in the expanded
  10558.                    memory hardware.
  10559.  
  10560.  
  10561.  
  10562.           EMM Functions                                                 174
  10563.  
  10564.  
  10565.  
  10566.  
  10567.  
  10568.           Function 30. Enable/Disable OS/E Function Set Functions
  10569.           Return Access Key subfunction
  10570.  
  10571.  
  10572.  
  10573.                AH = 84h   NON-RECOVERABLE.
  10574.                    The function code passed to the memory manager is not
  10575.                    defined.
  10576.  
  10577.                AH = 8Fh   NON-RECOVERABLE.
  10578.                    The subfunction parameter is invalid.
  10579.  
  10580.                AH = A4h   NON-RECOVERABLE.
  10581.                    The operating system has denied access to this function. 
  10582.                    The function cannot be used at this time.  The value of
  10583.                    the key which was passed to this function does not
  10584.                    entitle the program to execute this function.
  10585.  
  10586.  
  10587.           EXAMPLE
  10588.  
  10589.           access_key                     DW 2 DUP (?)
  10590.  
  10591.           MOV   BX,access_key[0]
  10592.           MOV   CX,access_key[2]
  10593.           MOV   AX,5D02h                 ; load function code
  10594.           INT   67h                      ; call the memory manager
  10595.           OR    AH,AH                    ; check EMM status
  10596.           JNZ   emm_err_handler          ; jump to error handler on error
  10597.  
  10598.  
  10599.  
  10600.  
  10601.  
  10602.  
  10603.  
  10604.  
  10605.  
  10606.  
  10607.  
  10608.  
  10609.  
  10610.  
  10611.  
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.  
  10620.  
  10621.           EMM Functions                                                 175
  10622.  
  10623.  
  10624.  
  10625.  
  10626.  
  10627.           Appendix A
  10628.           FUNCTION AND STATUS CODE CROSS REFERENCE TABLES
  10629.  
  10630.  
  10631.  
  10632.                This appendix contains two cross reference tables:  one
  10633.                lists the function codes and the status codes they return;
  10634.                the other lists the status codes and the functions that
  10635.                return them.
  10636.  
  10637.  
  10638.           Table A-1.  Function and Status Code Cross Reference
  10639.           ----------------------------------------------------------------
  10640.  
  10641.           Function        Status                 Description
  10642.  
  10643.           ----------------------------------------------------------------
  10644.  
  10645.              40h    00h, 80h, 81h, 84h   Get Memory Manager Status
  10646.  
  10647.              41h    00h, 80h, 81h, 84h   Get Page Frame Segment Address
  10648.  
  10649.              42h    00h, 80h, 81h, 84h   Get Unallocated Page Count
  10650.  
  10651.              43h    00h, 80h, 81h, 84h   Allocate Pages
  10652.                     85h, 87h, 88h
  10653.  
  10654.              44h    00h, 80h, 81h, 83h   Map/Unmap Handle Page
  10655.                     84h, 8Ah, 8Bh
  10656.  
  10657.              45h    00h, 80h, 81h, 83h   Deallocate Pages
  10658.                     84h, 86h
  10659.  
  10660.              46h    00h, 80h, 81h, 84h   Get EMM Version
  10661.  
  10662.              47h    00h, 80h, 81h, 83h   Save Page Map
  10663.                     84h, 8Ch, 8Dh
  10664.  
  10665.              48h    00h, 80h, 81h, 83h   Restore Page Map
  10666.                     84h, 8Eh
  10667.  
  10668.              49h                         Reserved
  10669.  
  10670.              4Ah                         Reserved
  10671.  
  10672.              4Bh    00h, 80h, 81h, 84h   Get EMM Handle Count
  10673.  
  10674.              4Ch    00h, 80h, 81h, 83h   Get EMM Handle Pages
  10675.                     84h
  10676.  
  10677.              4Dh    00h, 80h, 81h, 84h   Get All EMM Handle Pages
  10678.  
  10679.  
  10680.           Cross Reference Tables                                        176
  10681.  
  10682.  
  10683.  
  10684.  
  10685.  
  10686.           Table A-1.  Function and Status Code Cross Reference (continued)
  10687.           ----------------------------------------------------------------
  10688.  
  10689.           Function        Status                 Description
  10690.  
  10691.           ----------------------------------------------------------------
  10692.  
  10693.            4E00h    00h, 80h, 81h, 84h   Get Page Map
  10694.                     8Fh
  10695.  
  10696.            4E01h    00h, 80h, 81h, 84h   Set Page Map
  10697.                     8Fh, A3h
  10698.  
  10699.            4E02h    00h, 80h, 81h, 84h   Get & Set Page Map
  10700.                     8Fh, A3h
  10701.  
  10702.            4E03h    00h, 80h, 81h, 84h   Get Size of Page Map Save Array
  10703.                     8Fh
  10704.  
  10705.            4F00h    00h, 80h, 81h, 84h   Get Partial Page Map
  10706.                     8Bh, 8Fh, A3h
  10707.  
  10708.            4F01h    00h, 80h, 81h, 84h   Set Partial Page Map
  10709.                     8Fh, A3h
  10710.  
  10711.            4F02h    00h, 80h, 81h, 84h   Get Size of Partial Page Map Array
  10712.                     8Bh, 8Fh
  10713.  
  10714.            5000h    00h, 80h, 81h, 83h   Map/Unmap Multiple Handle Pages
  10715.                     84h, 8Ah, 8Bh, 8Fh   (physical page number mode)
  10716.  
  10717.            5001h    00h, 80h, 81h, 83h   Map/Unmap Multiple Handle Pages
  10718.                     84h, 8Ah, 8Bh, 8Fh   (segment address mode)
  10719.  
  10720.              51h    00h, 80h, 81h, 83h   Reallocate Pages
  10721.                     84h, 87h, 88h
  10722.  
  10723.            5200h    00h, 80h, 81h, 83h   Get Handle Attribute
  10724.                     84h, 8Fh, 91h
  10725.  
  10726.            5201h    00h, 80h, 81h, 83h   Set Handle Attribute
  10727.                     84h, 8Fh, 90h, 91h
  10728.  
  10729.            5202h    00h, 80h, 81h, 84h   Get Handle Attribute Capability
  10730.                     8Fh
  10731.  
  10732.            5300h    00h, 80h, 81h, 83h   Get Handle Name
  10733.                     84h, 8Fh
  10734.  
  10735.            5301h    00h, 80h, 81h, 83h   Set Handle Name
  10736.                     84h, 8Fh, A1h
  10737.  
  10738.  
  10739.           Cross Reference Tables                                        177
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.           Table A-1.  Function and Status Code Cross Reference (continued)
  10746.           ----------------------------------------------------------------
  10747.  
  10748.           Function        Status                 Description
  10749.  
  10750.           ----------------------------------------------------------------
  10751.  
  10752.            5400h    00h, 80h, 81h, 84h   Get Handle Directory
  10753.                     8Fh
  10754.  
  10755.            5401h    00h, 80h, 81h, 84h   Search for Named Handle
  10756.                     8Fh, A0h, A1h
  10757.  
  10758.            5402h    00h, 80h, 81h, 84h   Get Total Handles
  10759.                     8Fh
  10760.  
  10761.            5500h    00h, 80h, 81h, 83h   Alter Page Map & Jump (Physical   
  10762.                     84h, 8Ah, 8Bh, 8Fh   page mode)
  10763.  
  10764.            5501h    00h, 80h, 81h, 83h   Alter Page Map & Jump (Segment    
  10765.                     84h, 8Ah, 8Bh, 8Fh   address mode)
  10766.  
  10767.            5600h    00h, 80h, 81h, 83h   Alter Page Map & Call (Physical   
  10768.                     84h, 8Ah, 8Bh, 8Fh   page mode)
  10769.  
  10770.            5601h    00h, 80h, 81h, 83h   Alter Page Map & Call (Segment    
  10771.                     84h, 8Ah, 8Bh, 8Fh   address mode)
  10772.  
  10773.            5602h    00h, 80h, 81h, 84h   Get Alter Page Map & Call Stack   
  10774.                     8Fh                  Space Size
  10775.  
  10776.            5700h    00h, 80h, 81h, 83h   Move Memory Region
  10777.                     84h, 8Ah, 8Fh, 92h
  10778.                     93h, 94h, 95h, 96h
  10779.                     98h, A2h
  10780.  
  10781.            5701h    00h, 80h, 81h, 83h   Exchange Memory Region
  10782.                     84h, 8Ah, 8Fh, 93h
  10783.                     94h, 95h, 96h, 97h
  10784.                     98h, A2h
  10785.  
  10786.            5800h    00h, 80h, 81h, 84h   Get Mappable Physical Address     
  10787.                     8Fh                  Array
  10788.  
  10789.            5801h    00h, 80h, 81h, 84h   Get Mappable Physical Address     
  10790.                     8Fh                  Array Entries
  10791.  
  10792.            5900h    00h, 80h, 81h, 84h   Get Expanded Memory Hardware      
  10793.                     8Fh, A4h             Information
  10794.  
  10795.            5901h    00h, 80h, 81h, 84h   Get Unallocated Raw Page Count
  10796.                     8Fh
  10797.  
  10798.           Cross Reference Tables                                        178
  10799.  
  10800.  
  10801.  
  10802.  
  10803.  
  10804.           Table A-1.  Function and Status Code Cross Reference (continued)
  10805.           ----------------------------------------------------------------
  10806.  
  10807.           Function        Status                 Description
  10808.  
  10809.           ----------------------------------------------------------------
  10810.  
  10811.              5Ah    00h, 80h, 81h, 84h   Allocate Raw Pages
  10812.                     85h, 87h, 88h
  10813.  
  10814.            5B00h    00h, 80h, 81h, 84h   Get Alternate Map Register Set
  10815.                     8Fh, A4h
  10816.  
  10817.            5B01h    00h, 80h, 81h, 84h   Set Alternate Map Register Set
  10818.                     8Fh, 9Ah, 9Ch, 9Dh
  10819.                     A3h, A4h
  10820.  
  10821.            5B02h    00h, 80h, 81h, 84h   Get Alternate Map Save Array Size
  10822.                     8Fh, A4h
  10823.  
  10824.            5B03h    00h, 80h, 81h, 84h   Allocate Alternate Map Register   
  10825.                     8Fh, 9Bh, A4h        Set
  10826.  
  10827.            5B04h    00h, 80h, 81h, 84h   Deallocate Alternate Map Register 
  10828.                     8Fh, 9Ch, 9Dh, A4h   Set
  10829.  
  10830.            5B05h    00h, 80h, 81h, 84h   Allocate DMA Register Set
  10831.                     8Fh, 9Bh, A4h
  10832.  
  10833.            5B06h    00h, 80h, 81h, 84h   Enable DMA on Alternate Map       
  10834.                     8Fh, 9Ah, 9Ch, 9Dh   Register Set
  10835.                     9Eh, 9Fh, A4h
  10836.  
  10837.            5B07h    00h, 80h, 81h, 84h   Disable DMA on Alternate Map      
  10838.                     8Fh, 9Ah, 9Ch, 9Dh   Register Set
  10839.                     9Eh, 9Fh, A4h
  10840.  
  10841.            5B08     00h, 80h, 81h, 84h   Deallocate DMA Register Set
  10842.                     8Fh, 9Ch, 9Dh, A4h
  10843.  
  10844.              5Ch    00h, 80h, 81h, 84h   Prepare Expanded Memory Hardware
  10845.                                          for Warmboot
  10846.  
  10847.            5D00h    00h, 80h, 81h, 84h   Enable Operating System Function  
  10848.                     8Fh, A4h             Set
  10849.  
  10850.            5D01h    00h, 80h, 81h, 84h   Disable Operating System Function 
  10851.                     8Fh, A4h             Set
  10852.  
  10853.            5D02h    00h, 80h, 81h, 84h   Return Operating System Access Key
  10854.                     8Fh, A4h
  10855.           ----------------------------------------------------------------
  10856.  
  10857.           Cross Reference Tables                                        179
  10858.  
  10859.  
  10860.  
  10861.  
  10862.  
  10863.           Table A-2.  Status and Function Code Cross Reference
  10864.           ----------------------------------------------------------------
  10865.  
  10866.           Status      Function                   Description
  10867.  
  10868.           ----------------------------------------------------------------
  10869.  
  10870.            00h   All                  The function completed normally.
  10871.  
  10872.            80h   All                  The memory manager has detected a
  10873.                                       malfunction in the expanded memory
  10874.                                       software.  A condition has been
  10875.                                       detected which would not have
  10876.                                       occurred if the memory manager had
  10877.                                       been operating correctly.
  10878.  
  10879.            81h   All                  The memory manager has detected a
  10880.                                       malfunction in the expanded memory
  10881.                                       hardware.  A condition has been
  10882.                                       detected which would not occur if the
  10883.                                       memory hardware were working correct-
  10884.                                       ly.  Diagnostics should be run on the
  10885.                                       expanded memory system to determine
  10886.                                       the source of the problem.
  10887.  
  10888.            82h   None                 This error code is not returned in
  10889.                                       version 3.2 of the memory manager or
  10890.                                       above.  In earlier versions of the
  10891.                                       memory manager this code meant a
  10892.                                       "busy" status.  This status indicated
  10893.                                       that the memory manager was already
  10894.                                       processing an expanded memory request
  10895.                                       when the current request was made and
  10896.                                       is unable to process another request. 
  10897.                                       In versions 3.2 of the memory manager
  10898.                                       and above, the memory manager is
  10899.                                       never "busy" and can always honor
  10900.                                       requests.
  10901.  
  10902.            83h   44h, 45h, 47h, 48h   The memory manager can not find the
  10903.                  4Ch, 5000h, 5001h    handle specified.  The program has
  10904.                  51h, 5200h, 5201h    probably corrupted its specified
  10905.                  5300h, 5301h         handle.  The memory manager does not
  10906.                  5500h, 5501h         have any information pertaining to
  10907.                  5600h, 5601h         the  specified handle.  The program
  10908.                  5700h, 5701h         has probably corrupted its handle.
  10909.  
  10910.            84h   All                  The function code passed to the
  10911.                                       manager is not currently defined. 
  10912.                                       Function codes in the range 40h
  10913.                                       through 5Eh are currently defined.
  10914.  
  10915.  
  10916.           Cross Reference Tables                                        180
  10917.  
  10918.  
  10919.  
  10920.  
  10921.  
  10922.           Table A-2.  Status and Function Code Cross Reference (continued)
  10923.           ----------------------------------------------------------------
  10924.  
  10925.           Status      Function                   Description
  10926.  
  10927.           ----------------------------------------------------------------
  10928.  
  10929.            85h   43h, 5Ah             No handles are currently available. 
  10930.                                       All assignable handles are currently
  10931.                                       in use.  The program may re-request
  10932.                                       the assignment of a handle in the
  10933.                                       hope that another program has
  10934.                                       released a handle.  The maximum
  10935.                                       number of handles that may be
  10936.                                       supported is 255.
  10937.  
  10938.            86h   45h                  A mapping context restoration error
  10939.                                       has been detected.  This error occurs
  10940.                                       when a program attempts to return a
  10941.                                       handle and there is still a "mapping
  10942.                                       context" on the context stack for the
  10943.                                       indicated handle.  A program can
  10944.                                       recover from this error by restoring
  10945.                                       the mapping context before returning
  10946.                                       the handle.
  10947.  
  10948.            87h   43h, 51h, 5Ah        The number of total pages that are
  10949.                                       available in the system is insuffi-
  10950.                                       cient to honor the request.  The
  10951.                                       program can recover from this
  10952.                                       condition by requesting fewer pages.
  10953.  
  10954.            88h   43h, 51h, 5Ah        The number of unallocated pages
  10955.                                       currently available is insufficient
  10956.                                       to honor the allocation request.  The
  10957.                                       program can recover from this
  10958.                                       condition by re-posting the request
  10959.                                       or by requesting fewer pages.
  10960.  
  10961.            89h   None                 This error code is not returned in
  10962.                                       version 4.0 of the memory manager or
  10963.                                       above.  In earlier versions of the
  10964.                                       memory manager, this code indicated
  10965.                                       that zero pages could not be assigned
  10966.                                       to a handle.  This is no longer an
  10967.                                       error condition.
  10968.  
  10969.  
  10970.  
  10971.  
  10972.  
  10973.  
  10974.  
  10975.           Cross Reference Tables                                        181
  10976.  
  10977.  
  10978.  
  10979.  
  10980.  
  10981.           Table A-2.  Status and Function Code Cross Reference (continued)
  10982.           ----------------------------------------------------------------
  10983.  
  10984.           Status      Function                   Description
  10985.  
  10986.           ----------------------------------------------------------------
  10987.  
  10988.            8Ah   44h, 5000h, 5001h    The logical page to map into memory
  10989.                  5500h, 5501h         is out of the range of logical pages
  10990.                  5600h, 5601h         which are allocated to the handle. 
  10991.                  5700h, 5701h         The program can recover from this
  10992.                                       condition by attempting to map a
  10993.                                       logical page which is within the
  10994.                                       bounds for the handle.
  10995.  
  10996.            8Bh   44h, 4F00h, 4F02h    One or more of the physical pages is
  10997.                  5000h, 5001h         out of the range of allowable
  10998.                  5600h, 5601h         physical pages.  Physical page
  10999.                  5500h, 5501          numbers are numbered zero-relative. 
  11000.                                       The program can recover from this
  11001.                                       condition by mapping at a physical
  11002.                                       page which is in the range from zero
  11003.                                       to three.
  11004.  
  11005.            8Ch   47h                  The mapping register context save
  11006.                                       area is full.  The program can
  11007.                                       recover from this condition by
  11008.                                       attempting to save the mapping
  11009.                                       registers again.
  11010.  
  11011.            8Dh   47h                  The mapping register context stack
  11012.                                       already has a context associated with
  11013.                                       the handle.  The program has at-
  11014.                                       tempted to save the mapping register
  11015.                                       context when there was already a
  11016.                                       context for the handle on the stack. 
  11017.                                       The program can recover from this
  11018.                                       condition by not attempting to save
  11019.                                       the context again (this assumes the
  11020.                                       mapping register context on the stack
  11021.                                       for the handle is correct).
  11022.  
  11023.  
  11024.  
  11025.  
  11026.  
  11027.  
  11028.  
  11029.  
  11030.  
  11031.  
  11032.  
  11033.  
  11034.           Cross Reference Tables                                        182
  11035.  
  11036.  
  11037.  
  11038.  
  11039.  
  11040.           Table A-2.  Status and Function Code Cross Reference (continued)
  11041.           ----------------------------------------------------------------
  11042.  
  11043.           Status      Function                   Description
  11044.  
  11045.           ----------------------------------------------------------------
  11046.  
  11047.            8Eh   48h                  The mapping register context stack
  11048.                                       does not have a context associated
  11049.                                       with the handle.  The program has
  11050.                                       attempted to restore the mapping
  11051.                                       register context when there was no
  11052.                                       context for the handle on the stack. 
  11053.                                       The program can recover from this
  11054.                                       condition by not attempting to
  11055.                                       restore the context again (this
  11056.                                       assumes the current mapping register
  11057.                                       context is correct).
  11058.  
  11059.            8Fh   All functions        The subfunction parameter passed to
  11060.                  requiring            the function is not defined.
  11061.                  subfunction codes
  11062.  
  11063.            90h   5201h                The attribute type is undefined.
  11064.  
  11065.            91h   5200h, 5201h         The system configuration does not
  11066.                                       support non-volatility.
  11067.  
  11068.            92h   5700h                The source and destination expanded
  11069.                                       memory regions have the same handle
  11070.                                       and overlap.  This is valid for a
  11071.                                       move.  The move has been completed
  11072.                                       and the destination region has a full
  11073.                                       copy of the source region.  However,
  11074.                                       at least a portion of the source
  11075.                                       region has been overwritten by the
  11076.                                       move.  Note that the source and
  11077.                                       destination expanded memory regions
  11078.                                       with different handles will never
  11079.                                       physically overlap because the
  11080.                                       different handles specify totally
  11081.                                       different regions of expanded memory.
  11082.  
  11083.  
  11084.  
  11085.  
  11086.  
  11087.  
  11088.  
  11089.  
  11090.  
  11091.  
  11092.  
  11093.           Cross Reference Tables                                        183
  11094.  
  11095.  
  11096.  
  11097.  
  11098.  
  11099.           Table A-2.  Status and Function Code Cross Reference (continued)
  11100.           ----------------------------------------------------------------
  11101.  
  11102.           Status      Function                   Description
  11103.  
  11104.           ----------------------------------------------------------------
  11105.  
  11106.            93h   5700h, 5701h         The length of the specified source or
  11107.                                       destination expanded memory region
  11108.                                       exceeds the length of the expanded
  11109.                                       memory region allocated to the
  11110.                                       specified source or destination
  11111.                                       handle.  There are insufficient pages
  11112.                                       allocated to this handle to move/ex-
  11113.                                       change a region of the size speci-
  11114.                                       fied.  The program can recover from
  11115.                                       this condition by attempting to
  11116.                                       allocate additional pages to the
  11117.                                       destination or source handle or by
  11118.                                       reducing the specified length. 
  11119.                                       However, if the application program
  11120.                                       has allocated as much expanded memory
  11121.                                       as it thought it needed, this may be
  11122.                                       a program error and is therefore not
  11123.                                       recoverable.
  11124.  
  11125.            94h   5700h, 5701h         The conventional memory region and
  11126.                                       expanded memory region overlap.  This
  11127.                                       is invalid, the conventional memory
  11128.                                       region cannot overlap the expanded
  11129.                                       memory region.
  11130.  
  11131.            95h   5700h, 5701h         The offset within the logical page
  11132.                                       exceeds the length of the logical
  11133.                                       page.  The initial source or destina-
  11134.                                       tion offsets within an expanded
  11135.                                       memory region must be between 0 and
  11136.                                       the (length of a logical page - 1) or
  11137.                                       16383 (3FFFh).
  11138.  
  11139.            96h   5700h, 5701h         Region length exceeds 1M-byte limit.
  11140.  
  11141.  
  11142.  
  11143.  
  11144.  
  11145.  
  11146.  
  11147.  
  11148.  
  11149.  
  11150.  
  11151.  
  11152.           Cross Reference Tables                                        184
  11153.  
  11154.  
  11155.  
  11156.  
  11157.  
  11158.           Table A-2.  Status and Function Code Cross Reference (continued)
  11159.           ----------------------------------------------------------------
  11160.  
  11161.           Status      Function                   Description
  11162.  
  11163.           ----------------------------------------------------------------
  11164.  
  11165.            97h   5701h                The source and destination expanded
  11166.                                       memory regions have the SAME handle
  11167.                                       AND overlap.  This is invalid; the
  11168.                                       source and destination expanded
  11169.                                       memory regions cannot have the same
  11170.                                       handle and overlap when they are
  11171.                                       being exchanged.  Note that the
  11172.                                       source and destination expanded
  11173.                                       memory regions with different handles
  11174.                                       will never physically overlap because
  11175.                                       the different handles specify totally
  11176.                                       different regions of expanded memory.
  11177.  
  11178.            98h   5700h, 5701h         The memory source and destination
  11179.                                       types are undefined/not supported.
  11180.  
  11181.            9Ah   5B01h, 5B06h         Alternate map register sets are
  11182.                  5B07h                supported, but the alternate map
  11183.                                       register set specified is not
  11184.                                       supported.
  11185.  
  11186.            9Bh   5B03h, 5B05h         Alternate map/DMA register sets are
  11187.                                       supported.  However, all alternate
  11188.                                       map/DMA register sets are currently
  11189.                                       allocated.
  11190.  
  11191.            9Ch   5B01h, 5B04h         Alternate map/DMA register sets are
  11192.                  5B06h, 5B07h         not supported, and the alternate
  11193.                  5B08h                map/DMA register set specified is not
  11194.                                       zero.
  11195.  
  11196.            9Dh   5B01h, 5B04h         Alternate map/DMA register sets are
  11197.                  5B06h, 5B07h         supported, but the alternate map
  11198.                  5B08h                register set specified is not
  11199.                                       defined, not allocated, or is the
  11200.                                       currently allocated map register set.
  11201.  
  11202.            9Eh   5B06h, 5B07h         Dedicated DMA channels are not
  11203.                                       supported.
  11204.  
  11205.            9Fh   5B06h, 5B07h         Dedicated DMA channels are supported. 
  11206.                                       But the DMA channel specified is not
  11207.                                       supported.
  11208.  
  11209.  
  11210.  
  11211.           Cross Reference Tables                                        185
  11212.  
  11213.  
  11214.  
  11215.  
  11216.  
  11217.           Table A-2.  Status and Function Code Cross Reference (continued)
  11218.           ----------------------------------------------------------------
  11219.  
  11220.           Status      Function                   Description
  11221.  
  11222.           ----------------------------------------------------------------
  11223.  
  11224.            A0h   5401h                No corresponding handle value could
  11225.                                       be found for the handle name speci-
  11226.                                       fied.
  11227.  
  11228.            A1h   5301h, 5401h         A handle with this name already
  11229.                                       exists.  The specified handle was not
  11230.                                       assigned a name.
  11231.  
  11232.            A2h   5700h, 5701h         An attempt was made to "wrap around"
  11233.                                       the 1M-byte address space during the
  11234.                                       move/exchange.  The source starting
  11235.                                       address together with the length of
  11236.                                       the region to be moved/exchanged
  11237.                                       exceeds 1M bytes.  No data was
  11238.                                       moved/exchanged.
  11239.  
  11240.            A3h   4E01h, 4E02h         The contents of the data structure
  11241.                  4F00h, 4F01h         passed to the function have either
  11242.                  5B01h                been corrupted or are meaningless.
  11243.  
  11244.            A4h   5900h, 5B00h         The operating system has denied
  11245.                  5B01h, 5B02h         access to this function.  The 
  11246.                  5B03h, 5B04h         function cannot be used at this time.
  11247.                  5B05h, 5B06h
  11248.                  5B07h, 5B08h
  11249.                  5D00h, 5D01h
  11250.                  5D02h
  11251.  
  11252.           ----------------------------------------------------------------
  11253.  
  11254.  
  11255.  
  11256.  
  11257.  
  11258.  
  11259.  
  11260.  
  11261.  
  11262.  
  11263.  
  11264.  
  11265.  
  11266.  
  11267.  
  11268.  
  11269.  
  11270.           Cross Reference Tables                                        186
  11271.  
  11272.  
  11273.  
  11274.  
  11275.  
  11276.           Appendix B
  11277.           TESTING FOR THE PRESENCE OF THE EXPANDED MEMORY MANAGER
  11278.  
  11279.  
  11280.  
  11281.                Before an application program can use the Expanded Memory
  11282.                Manager, it must determine whether DOS has loaded the
  11283.                manager.  This appendix describes two methods your program
  11284.                can use to test for the presence of the memory manager and
  11285.                how to choose the correct one for your situation.
  11286.  
  11287.                The first method uses the DOS "open handle" technique; the
  11288.                second method uses the DOS "get interrupt vector" technique.
  11289.  
  11290.  
  11291.           Which method should your program use?
  11292.  
  11293.                The majority of application programs can use either the
  11294.                "open handle" or the "get interrupt vector" method. 
  11295.                However, if your program is a device driver or if it
  11296.                interrupts DOS during file system operations, you must use
  11297.                only the "get interrupt vector" method.
  11298.  
  11299.                Device drivers execute from within DOS and can't access the
  11300.                DOS file system; programs that interrupt DOS during file
  11301.                system operations have a similar restriction.  During their
  11302.                interrupt processing procedures, they can't access the DOS
  11303.                file system because another program may be using the system. 
  11304.                Since the "get interrupt vector" method doesn't require the
  11305.                DOS file system, you must use it for these types of pro-
  11306.                grams.
  11307.  
  11308.  
  11309.           The "open handle" technique
  11310.  
  11311.                Most application programs can use the DOS "open handle"
  11312.                technique to test for the presence of the memory manager. 
  11313.                This section describes how to use the technique and gives an
  11314.                example.
  11315.  
  11316.           Caution.........................................................
  11317.                Don't use this technique if your program is a device driver
  11318.                or if it interrupts DOS during file system operations.  Use
  11319.                the "get interrupt vector" technique described later in this
  11320.                appendix.
  11321.  
  11322.  
  11323.           Using the "open handle" technique
  11324.  
  11325.                This section describes how to use the DOS "open handle"
  11326.                technique to test for the presence of the memory manager. 
  11327.                Follow these steps in order:
  11328.  
  11329.           Testing For The Presence Of The EMM                           187
  11330.  
  11331.  
  11332.  
  11333.  
  11334.  
  11335.                1.  Issue an "open handle" command (DOS function 3Dh) in
  11336.                    "read only" access mode (register AL = 0).  This
  11337.                    function requires your program to point to an ASCII
  11338.                    string which contains the path name of the file or
  11339.                    device in which you're interested (register set DS:DX
  11340.                    contains the pointer).  In this case the file is
  11341.                    actually the name of the memory manager.
  11342.  
  11343.                    You should format the ASCII string as follows:
  11344.  
  11345.                    ASCII_device_name  DB  'EMMXXXX0', 0
  11346.  
  11347.                    The ASCII codes for the capital letters EMMXXXX0 are
  11348.                    terminated by a byte containing a value of zero.
  11349.  
  11350.                2.  If DOS returns no error status code, skip Steps 3 and 4
  11351.                    and go to Step 5.  If DOS returns a "Too many open
  11352.                    files" error status code, go to Step 3.  If DOS returns
  11353.                    a "File/Path not found" error status code, skip Step 3
  11354.                    and go to Step 4.
  11355.  
  11356.                3.  If DOS returns a "Too many open files" (not enough
  11357.                    handles) status code, your program should invoke the
  11358.                    "open file" command before it opens any other files. 
  11359.                    This will guarantee that at least one file handle will
  11360.                    be available to perform the function without causing
  11361.                    this error.
  11362.  
  11363.                    After the program performs the "open file" command, it
  11364.                    should perform the test described in Step 6 and close
  11365.                    the "file handle" (DOS function 3Eh).  Don't keep the
  11366.                    manager "open" after this status test is performed since
  11367.                    "manager" functions are not available through DOS.  Go
  11368.                    to Step 6.
  11369.  
  11370.                4.  If DOS returns a "File/Path not found," the memory
  11371.                    manager is not installed.  If your application requires
  11372.                    the memory manager, the user will have to reboot the
  11373.                    system with a disk containing the memory manager and the
  11374.                    appropriate CONFIG.SYS file before proceeding.
  11375.  
  11376.                5.  If DOS doesn't return an error status code you can
  11377.                    assume that either a device with the name EMMXXXX0 is
  11378.                    resident in the system, or a file with this name is on
  11379.                    disk in the current disk drive.  Go to Step 6.
  11380.  
  11381.                6.  Issue an "I/O Control for Devices" command (DOS function
  11382.                    44h) with a "get device information" command (register
  11383.                    AL = 0).  DOS function 44h determines whether EMMXXXX0
  11384.                    is a device or a file.
  11385.  
  11386.  
  11387.  
  11388.           Testing For The Presence Of The EMM                           188
  11389.  
  11390.  
  11391.  
  11392.  
  11393.  
  11394.                    You must use the file handle (register BX) which you
  11395.                    obtained in Step 1 to access the "EMM" device.
  11396.  
  11397.                    This function returns the "device information" in a word
  11398.                    (register DX).  Go to Step 7.
  11399.  
  11400.                7.  If DOS returns any error status code, you should assume
  11401.                    that the memory manager device driver is not installed. 
  11402.                    If your application requires the memory manager, the
  11403.                    user will have to reboot the system with a disk contain-
  11404.                    ing the memory manager and the appropriate CONFIG.SYS
  11405.                    file before proceeding.
  11406.  
  11407.                8.  If DOS didn't return an error status, test the contents
  11408.                    of bit 7 (counting from 0) of the "device information"
  11409.                    word (register DX) the function returned.  Go to Step 9.
  11410.  
  11411.                9.  If bit 7 of the "device information" word contains a
  11412.                    zero, then EMMXXXX0 is a file, and the memory manager
  11413.                    device driver is not present.  If your application
  11414.                    requires the memory manager, the user will have to
  11415.                    reboot the system with a disk containing the memory
  11416.                    manager and the appropriate CONFIG.SYS file before
  11417.                    proceeding.
  11418.  
  11419.                    If bit 7 contains a one, then EMMXXXX0 is a device.  Go
  11420.                    to Step 10.
  11421.  
  11422.                10. Issue an "I/O Control for Devices" command (DOS function
  11423.                    44h) with a "get output status" command (register AL =
  11424.                    7).
  11425.  
  11426.                    You must use the file handle you obtained in Step 1 to
  11427.                    access the "EMM" device (register BX).  Go to Step 11.
  11428.  
  11429.                11. If the expanded memory device driver is "ready," the
  11430.                    memory manager passes a status value of "FFh" in
  11431.                    register AL.  The status value is "00h" if the device
  11432.                    driver is "not ready."
  11433.  
  11434.                    If the memory manager device driver is "not ready" and
  11435.                    your application requires its presence, the user will
  11436.                    have to reboot the system with a disk containing the
  11437.                    memory manager and the appropriate CONFIG.SYS file
  11438.                    before proceeding.
  11439.  
  11440.                    If the memory manager device driver is "ready," go to
  11441.                    Step 12.
  11442.  
  11443.  
  11444.  
  11445.  
  11446.  
  11447.           Testing For The Presence Of The EMM                           189
  11448.  
  11449.  
  11450.  
  11451.  
  11452.  
  11453.                12. Issue a "Close File Handle" command (DOS function 3Eh)
  11454.                    to close the expanded memory device driver.  You must
  11455.                    use the file handle you obtained in Step 1 to close the
  11456.                    "EMM" device (register BX).
  11457.  
  11458.  
  11459.  
  11460.  
  11461.  
  11462.  
  11463.  
  11464.  
  11465.  
  11466.  
  11467.  
  11468.  
  11469.  
  11470.  
  11471.  
  11472.  
  11473.  
  11474.  
  11475.  
  11476.  
  11477.  
  11478.  
  11479.  
  11480.  
  11481.  
  11482.  
  11483.  
  11484.  
  11485.  
  11486.  
  11487.  
  11488.  
  11489.  
  11490.  
  11491.  
  11492.  
  11493.  
  11494.  
  11495.  
  11496.  
  11497.  
  11498.  
  11499.  
  11500.  
  11501.  
  11502.  
  11503.  
  11504.  
  11505.  
  11506.           Testing For The Presence Of The EMM                           190
  11507.  
  11508.  
  11509.  
  11510.  
  11511.  
  11512.           An example of the "open handle" technique
  11513.  
  11514.                The following procedure is an example of the "open handle"
  11515.                technique outlined in the previous section.
  11516.  
  11517.           ;--------------------------------------------------------------;
  11518.           ;    The following procedure tests for the presence of the     ;
  11519.           ;    EMM in the system.  It returns the CARRY FLAG SET if      ;
  11520.           ;    the EMM is present.  If the EMM is not present, this      ;
  11521.           ;    procedure returns the CARRY FLAG CLEAR.                   ;
  11522.           ;--------------------------------------------------------------;
  11523.  
  11524.           first_test_for_EMM  PROC  NEAR
  11525.           PUSH  DS
  11526.           PUSH  CS
  11527.           POP   DS
  11528.           MOV   AX,3D00h                       ; issue "device open" in
  11529.           LEA   DX,ASCII_device_name           ; "read only" mode
  11530.           INT   21h
  11531.           JC    first_test_for_EMM_error_exit  ; test for error
  11532.                                                ; during "device open"
  11533.           MOV   BX,AX                          ; get the "file
  11534.                                                ; handle" returned by DOS
  11535.           MOV   AX,4400h                       ; issue "IOCTL
  11536.           INT   21h                            ; get device info"
  11537.           JC    first_test_for_EMM_error_exit  ; test for error
  11538.                                                ; during "get device info"
  11539.           TEST  DX,0080h                       ; test to determine
  11540.           JZ    first_test_for_EMM_error_exit  ; ASCII_device_name
  11541.                                                ; is a device or a file
  11542.           MOV   AX,4407h                       ; issue "IOCTL"
  11543.           INT   21h
  11544.           JC    first_test_for_EMM_error_exit  ; test for error
  11545.                                                ; during "IOCTL"
  11546.           PUSH  AX                             ; save "IOCTL" status
  11547.           MOV   AH,3Eh                         ; issue "close
  11548.           INT   21h                            ; file handle"
  11549.           POP   AX                             ; restore "IOCTL" status
  11550.           CMP   AL,0FFh                        ; test for "device
  11551.           JNE   first_test_for_EMM_error_exit  ; ready" status
  11552.                                                ; returned by the driver
  11553.           first_test_for_EMM_exit:
  11554.           POP   DS                             ; EMM is present
  11555.           STC                                  ; in the system
  11556.           RET
  11557.  
  11558.           first_test_for_EMM_error_exit:
  11559.           POP   DS                             ; EMM is NOT present
  11560.           CLC                                  ; in the system
  11561.           RET
  11562.           ASCII_device_name   DB  'EMMXXXX0', 0
  11563.           first_test_for_EMM  ENDP
  11564.  
  11565.           Testing For The Presence Of The EMM                           191
  11566.  
  11567.  
  11568.  
  11569.  
  11570.  
  11571.           The "get interrupt vector" technique
  11572.  
  11573.                Any type of program can use the DOS "get interrupt vector"
  11574.                technique to test for the presence of the memory manager. 
  11575.                This section describes how to use the technique and gives an
  11576.                example.
  11577.  
  11578.           Caution.........................................................
  11579.                Be sure to use this technique (and not the "open handle"
  11580.                technique) if your program is a device driver or if it
  11581.                interrupts DOS during file system operations.
  11582.  
  11583.  
  11584.           Using the "get interrupt vector" technique
  11585.  
  11586.                This section describes how to use the DOS "get interrupt
  11587.                vector" technique to test for the presence of the memory
  11588.                manager.  Follow these steps in order:
  11589.  
  11590.                1.  Issue a "get vector" command (DOS function 35h) to
  11591.                    obtain the contents of interrupt vector array entry
  11592.                    number 67h (addresses 0000:019Ch thru 0000:019Fh).
  11593.  
  11594.                    The memory manager uses this interrupt vector to perform
  11595.                    all manager functions.  The Offset portion of this
  11596.                    interrupt service routine address is stored in the word
  11597.                    located at address 0000:019Ch; the Segment portion is
  11598.                    stored in the word located at address 0000:019Eh.
  11599.  
  11600.                2.  Compare the "device name field" with the contents of the
  11601.                    ASCII string which starts at the address specified by
  11602.                    the segment portion of the contents of interrupt vector
  11603.                    address 67h and a fixed offset of 000Ah.  If DOS loaded
  11604.                    the memory manager at boot time this name field will
  11605.                    have the name of the device in it.
  11606.  
  11607.                    Since the memory manager is implemented as a character
  11608.                    device driver, its program origin is 0000h.  Device
  11609.                    drivers are required to have a "device header" located
  11610.                    at the program origin.  Within the "device header" is an
  11611.                    8 byte "device name field."  For a character mode device
  11612.                    driver this name field is always located at offset 000Ah
  11613.                    within the device header.  The device name field
  11614.                    contains the name of the device which DOS uses when it
  11615.                    references the device.
  11616.  
  11617.                    If the result of the "string compare" in this technique
  11618.                    is positive, the memory manager is present.
  11619.  
  11620.  
  11621.  
  11622.  
  11623.  
  11624.           Testing For The Presence Of The EMM                           192
  11625.  
  11626.  
  11627.  
  11628.  
  11629.  
  11630.           An example of the "get interrupt vector" technique
  11631.  
  11632.                The following procedure is an example of the "get interrupt
  11633.                vector" technique outlined in the previous section.
  11634.  
  11635.  
  11636.           ;--------------------------------------------------------------;
  11637.           ;    The following procedure tests for the presence of the     ;
  11638.           ;    EMM in the system.  It returns the CARRY FLAG SET if      ;
  11639.           ;    the EMM is present.  If the EMM is not present, this      ;
  11640.           ;    procedure returns the CARRY FLAG CLEAR.                   ;
  11641.           ;--------------------------------------------------------------;
  11642.  
  11643.  
  11644.           second_test_for_EMM  PROC  NEAR
  11645.           PUSH  DS
  11646.           PUSH  CS
  11647.           POP   DS
  11648.           MOV   AX,3567h                       ; issue "get interrupt
  11649.                                                ; vector"
  11650.           INT   21h
  11651.           MOV   DI,000Ah                       ; use the segment in ES
  11652.                                                ; returned by DOS, place
  11653.                                                ; the "device name field"
  11654.                                                ; OFFSET in DI
  11655.           LEA   SI,ASCII_device_name           ; place the OFFSET of the
  11656.                                                ; device name string in SI,
  11657.                                                ; the SEGMENT is already
  11658.                                                ; in DS
  11659.           MOV   CX,8                           ; compare the name strings
  11660.           CLD
  11661.           REPE  CMPSB
  11662.           JNE   second_test_for_EMM_error_exit
  11663.  
  11664.           second_test_for_EMM_exit:
  11665.           POP   DS                             ; EMM is present in
  11666.           STC                                  ; the system
  11667.           RET
  11668.  
  11669.           second_test_for_EMM_error_exit:
  11670.           POP   DS                             ; EMM is NOT present
  11671.           CLC                                  ; in the system
  11672.           RET
  11673.  
  11674.           ASCII_device_name   DB  'EMMXXXX0'
  11675.           second_test_for_EMM ENDP
  11676.  
  11677.  
  11678.  
  11679.  
  11680.  
  11681.  
  11682.  
  11683.           Testing For The Presence Of The EMM                           193
  11684.  
  11685.  
  11686.  
  11687.  
  11688.  
  11689.           Appendix C
  11690.           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES
  11691.  
  11692.  
  11693.  
  11694.                In addition to the functional specification, the expanded
  11695.                memory manager should provide certain resources.  The
  11696.                following guidelines are provided so required resources are
  11697.                present in expanded memory managers which comply with this
  11698.                version of the LIM specification.
  11699.  
  11700.                o   The amount of expanded memory supported:
  11701.                    Up to a maximum of 32M bytes of expanded memory should
  11702.                    be supported.
  11703.  
  11704.                o   The number of handles supported:
  11705.                    The maximum number of expanded memory handles provided
  11706.                    should be 255, the minimum should be 64.
  11707.  
  11708.                o   Handle Numbering:
  11709.                    Although a handle is a word quantity, there is a maximum
  11710.                    of 255 handles, including the operating system handle. 
  11711.                    This specification defines the handle word as follows: 
  11712.                    the low byte of the word is the actual handle value, the
  11713.                    high byte of the handle is set to 00h by the memory
  11714.                    manager.  Previous versions of this specification did
  11715.                    not specify the value of handles.
  11716.  
  11717.                o   New handle type:  Handles versus Raw Handles:
  11718.                    The difference between a raw handle and a regular handle
  11719.                    is slight.  If you use Function 27 to "Allocate raw
  11720.                    pages to a handle," what is returned in DX is termed a
  11721.                    raw handle.  The raw handle does not necessarily refer
  11722.                    to 16K-byte pages.  Instead it refers to the "raw" page
  11723.                    size, which depends on the expanded memory hardware.
  11724.  
  11725.                    An application program can use Function 26 to find the
  11726.                    raw page size, and by using the raw handle Function 27
  11727.                    returns, it can access them with the finer resolution
  11728.                    that a particular expanded memory board may allow.
  11729.  
  11730.                    On the other hand, applications which use Function 4 to
  11731.                    "allocate pages to handle" receive a handle which always
  11732.                    refers to 16K-byte pages.  On expanded memory boards
  11733.                    with smaller raw pages, the EMM driver will allocate and
  11734.                    maintain the number of raw pages it takes to create a
  11735.                    single composite 16K-byte page.  The difference between
  11736.                    the expanded memory boards' raw page size and the 16K-
  11737.                    byte LIM page size is transparent to the application
  11738.                    when it is using a handle obtained with Function 4.
  11739.  
  11740.  
  11741.  
  11742.           EMM Implementation Guidelines                                 194
  11743.  
  11744.  
  11745.  
  11746.  
  11747.  
  11748.                    The memory manager must differentiate between pages
  11749.                    allocated to handles and pages allocated to raw handles. 
  11750.                    The meaning of a call to the driver changes depending on
  11751.                    whether a handle or a raw handle is passed to the memory
  11752.                    manager.  If, for example, a handle is passed to
  11753.                    Function 18 (Reallocate), the memory manager will
  11754.                    increase or decrease the number of 16K-byte pages
  11755.                    allocated to the handle.  If Function 18 is passed a raw
  11756.                    handle, the memory manager will increase or decrease the
  11757.                    number of raw (non-16K-byte) pages allocated to the raw
  11758.                    handle.  For LIM standard boards, there is no difference
  11759.                    between pages and raw pages.
  11760.  
  11761.                o   The system Raw Handle (Raw Handle = 0000):
  11762.                    For expanded memory boards that can remap the memory in
  11763.                    the lower 640K-byte address space, managing the pages of
  11764.                    memory which are used to fill in the lower 640K can be a
  11765.                    problem.  To solve this problem, the memory manager will
  11766.                    create a raw handle with a value of 0000 when DOS loads
  11767.                    the manager.  This raw handle is called the system
  11768.                    handle.
  11769.  
  11770.                    At power up, the memory manager will allocate all of the
  11771.                    pages that are mapped into the lower 640K bytes to the
  11772.                    system handle.  These pages should be mapped in their
  11773.                    logical order.  For example, if the system board
  11774.                    supplies 256K bytes of RAM, and the 384K bytes above it
  11775.                    is mappable, the system handle should have its logical
  11776.                    page zero mapped into the first physical page at 256K,
  11777.                    its logical page one mapped into the next physical page,
  11778.                    and so on.
  11779.  
  11780.                    The system handle should deal with raw pages.  To
  11781.                    release some of these pages so application programs can
  11782.                    use them, an operating system could decrease the number
  11783.                    of pages allocated to the system handle with the
  11784.                    "Reallocate" function.  Invoking the "Deallocate"
  11785.                    function would decrease the system handle to zero size,
  11786.                    but it must not deallocate the raw handle itself.  The
  11787.                    "Deallocate" function treats the system handle dif-
  11788.                    ferently than it treats other raw handles.  If the
  11789.                    operating system can ever be "exited" (for example, the
  11790.                    way Windows can be exited), it must increase the size of
  11791.                    the system handle back to what is needed to fill 640K
  11792.                    and map these logical pages back into physical memory
  11793.                    before returning to DOS.
  11794.  
  11795.  
  11796.  
  11797.  
  11798.  
  11799.  
  11800.  
  11801.           EMM Implementation Guidelines                                 195
  11802.  
  11803.  
  11804.  
  11805.  
  11806.  
  11807.                    There are two functional special cases for this handle:
  11808.  
  11809.                    -   The first special case deals with Function 4
  11810.                        (Allocate Pages).  This function must never return
  11811.                        zero as a handle value.  Applications must always
  11812.                        invoke Function 4 to allocate pages and obtain a
  11813.                        handle which identifies its pages.  Since Function 4
  11814.                        will never return a handle value of zero, an
  11815.                        application will never gain access to this special
  11816.                        handle.
  11817.  
  11818.                    -   The second special case deals with Function 6
  11819.                        (Deallocate Pages).  If the operating system uses
  11820.                        Function 6 to deallocate the pages which are
  11821.                        allocated to the system handle, the pages will be
  11822.                        returned to the manager for use, but the handle will
  11823.                        not be available for reassignment.  The manager
  11824.                        should treat a "deallocate pages" function request
  11825.                        for this handle the same as a "reallocate pages"
  11826.                        function request, where the number of pages to
  11827.                        reallocate to this handle is zero.
  11828.  
  11829.                o   Terminate and Stay Resident (TSR) Program Cooperation:
  11830.                    In order for TSR's to cooperate with each other and with
  11831.                    other applications, TSR's must follow this rule:  a
  11832.                    program may only remap the DOS partition it lives in. 
  11833.                    This rule applies at all times, even when no expanded
  11834.                    memory is present.
  11835.  
  11836.                o   Accelerator Cards:
  11837.                    To support generic accelerator cards, the support of
  11838.                    Function 34, as defined by AST, is encouraged.
  11839.  
  11840.  
  11841.  
  11842.  
  11843.  
  11844.  
  11845.  
  11846.  
  11847.  
  11848.  
  11849.  
  11850.  
  11851.  
  11852.  
  11853.  
  11854.  
  11855.  
  11856.  
  11857.  
  11858.  
  11859.  
  11860.           EMM Implementation Guidelines                                 196
  11861.  
  11862.  
  11863.  
  11864.  
  11865.  
  11866.           Appendix D
  11867.           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28
  11868.  
  11869.  
  11870.  
  11871.                All expanded memory boards have a set of registers that
  11872.                "remember" the logical to physical page mappings.  Some
  11873.                boards have extra (or alternate) sets of these mapping
  11874.                registers.  Because no expanded memory board can supply an
  11875.                infinite number of alternate map register sets, this
  11876.                specification provides a way to simulate them using Function
  11877.                28 (Alternate Map Register Set).
  11878.  
  11879.  
  11880.           Examples
  11881.  
  11882.                For the examples in this section, assume the hardware
  11883.                supports alternate map register sets.  First Windows is
  11884.                brought up, then "Reversi" is started.  Then control is
  11885.                switched back to the MS-DOS Executive.  For this procedure,
  11886.                here are the calls to the expanded memory manager:
  11887.  
  11888.                                       Example 1
  11889.  
  11890.           Allocate alt reg set           ; Start up the MS-DOS
  11891.           (for MS-DOS Executive)         ; Executive
  11892.  
  11893.           Set alt reg set
  11894.           (for MS-DOS Executive)
  11895.  
  11896.           Allocate alt reg set           ; Start up Reversi
  11897.           (for Reversi)
  11898.  
  11899.           Set alt reg set
  11900.           (for Reversi)
  11901.  
  11902.           Map pages
  11903.           (for Reversi)
  11904.  
  11905.           Set alt ret set                ; Switch back to MS-DOS
  11906.           (for MS-DOS Executive)         ; Executive
  11907.  
  11908.  
  11909.  
  11910.  
  11911.  
  11912.  
  11913.  
  11914.  
  11915.  
  11916.  
  11917.  
  11918.  
  11919.           Operating System Use Of Function 28                           197
  11920.  
  11921.  
  11922.  
  11923.  
  11924.  
  11925.                Notice this procedure needed no "get" calls because the
  11926.                register set contained all the information needed to save a
  11927.                context.  However, using "Get" calls would have no ill
  11928.                effects.
  11929.  
  11930.                                       Example 2
  11931.  
  11932.           Allocate alt reg set           ; Start up MS-DOS
  11933.           (for MS-DOS Executive)         ; Executive
  11934.  
  11935.           Set alt reg set
  11936.           (For MS-DOS Executive)
  11937.  
  11938.           Get alt reg set
  11939.           (for MS-DOS Executive)
  11940.  
  11941.           Allocate alt reg set           ; Start up Reversi
  11942.           (for Reversi)
  11943.  
  11944.           Set alt reg set
  11945.           (for Reversi)
  11946.  
  11947.           Map pages
  11948.           (for Reversi)
  11949.  
  11950.           Get alt reg set
  11951.           (for Reversi)
  11952.  
  11953.           Set alt reg set                ; Switch back to MS-DOS
  11954.           (for MS-DOS Executive)         ; Executive
  11955.  
  11956.                The important point to follow is that a Set must always
  11957.                precede a Get.  The model of Set then Get is the inverse of
  11958.                what interrupt handlers use, which is Get then Set (Get the
  11959.                old map context and Set the new one).  Another crucial point
  11960.                is that an alternate map register set must have the current
  11961.                mapping when allocated; otherwise, the Set will create
  11962.                chaos.
  11963.  
  11964.                What happens if this is simulated in software?  The same Set
  11965.                and Get model applies.  The main difference is where the
  11966.                context is saved.
  11967.  
  11968.  
  11969.  
  11970.  
  11971.  
  11972.  
  11973.  
  11974.  
  11975.  
  11976.  
  11977.  
  11978.           Operating System Use Of Function 28                           198
  11979.  
  11980.  
  11981.  
  11982.  
  11983.  
  11984.                Since the allocate call is dynamic and there is no limit on
  11985.                the number of sets allocated, the OS/E must supply the space
  11986.                required.  Device drivers cannot allocate space dynamically,
  11987.                since the request would fail.  If the Allocate register set
  11988.                call returns a status indicating the alternate map register
  11989.                sets aren't supported, the OS/E must allocate space for the
  11990.                context.  It must also initialize the context using Function
  11991.                15.  At that point it can do the Set, passing a pointer to
  11992.                the map context space.  On the Get call, the EMM driver is
  11993.                to return a pointer to the same context space.
  11994.  
  11995.                                       Example 3
  11996.  
  11997.           Allocate alt reg set           ; Start up MS-DOS
  11998.           (for MS-DOS Executive)         ; Executive
  11999.  
  12000.           Get Page Map
  12001.           (for MS-DOS Executive)
  12002.  
  12003.           Set alt reg set
  12004.           (for MS-DOS Executive)
  12005.  
  12006.           Allocate alt reg set           ; Start up Reversi
  12007.           (for Reversi)
  12008.  
  12009.           Set alt reg set
  12010.           (for Reversi)
  12011.  
  12012.           Map pages
  12013.           (for Reversi)
  12014.  
  12015.           Get Page Map
  12016.           (for Reversi)
  12017.  
  12018.           Set alt ret set                ; Switch back to MS-DOS
  12019.           (for MS-DOS Executive)         ; Executive
  12020.  
  12021.  
  12022.  
  12023.  
  12024.  
  12025.  
  12026.  
  12027.  
  12028.  
  12029.  
  12030.  
  12031.  
  12032.  
  12033.  
  12034.  
  12035.  
  12036.  
  12037.           Operating System Use Of Function 28                           199
  12038.  
  12039.  
  12040.  
  12041.  
  12042.  
  12043.           GLOSSARY
  12044.  
  12045.  
  12046.  
  12047.                The following terms are used frequently in this specifica-
  12048.                tion:
  12049.  
  12050.  
  12051.           Allocate                 To reserve a specified amount of
  12052.                                    expanded memory pages.
  12053.  
  12054.           Application Program      An application program is the program
  12055.                                    you write and your customer uses.  Some
  12056.                                    categories of application software are
  12057.                                    word processors, database managers,
  12058.                                    spreadsheet managers, and project
  12059.                                    managers.
  12060.  
  12061.           Conventional memory      The memory between 0 and 640K bytes,
  12062.                                    address range 00000h thru 9FFFFh.
  12063.  
  12064.           Deallocate               To return previously allocated expanded
  12065.                                    memory to the memory manager.
  12066.  
  12067.           EMM                      See Expanded Memory Manager.
  12068.  
  12069.           Expanded memory          Expanded memory is memory outside DOS's
  12070.                                    640K-byte limit (usually in the range of
  12071.                                    C0000h thru EFFFFh).
  12072.  
  12073.           Expanded Memory          A device driver that controls the
  12074.             Manager (EMM)          interface between DOS application
  12075.                                    programs and expanded memory.
  12076.  
  12077.           Extended memory          The 15M-byte address between 100000h
  12078.                                    thru FFFFFFh available on an 80286
  12079.                                    processor when it is operating in
  12080.                                    protected virtual address mode.
  12081.  
  12082.           Handle                   A value that the EMM assigns and uses to
  12083.                                    identify a block of memory requested by
  12084.                                    an application program.  All allocated
  12085.                                    logical pages are associated with a
  12086.                                    particular handle.
  12087.  
  12088.           Logical Page             The EMM allocates expanded memory in
  12089.                                    units (typically 16K bytes) called
  12090.                                    logical pages.
  12091.  
  12092.           Mappable Segment         A 16K-byte region of memory which can
  12093.                                    have a logical page mapped at it.
  12094.  
  12095.  
  12096.           Glossary                                                      200
  12097.  
  12098.  
  12099.  
  12100.  
  12101.  
  12102.           Map Registers            The set of registers containing the
  12103.                                    current mapping context of the EMM
  12104.                                    hardware.
  12105.  
  12106.           Mapping                  The process of making a logical page of
  12107.                                    memory appear at a physical page.
  12108.  
  12109.           Mapping Context          The contents of the mapping registers at
  12110.                                    a specific instant.  This context
  12111.                                    represents a map state.
  12112.  
  12113.           Page Frame               A collection of 16K-byte contiguous
  12114.                                    physical pages from which an application
  12115.                                    program accesses expanded memory.
  12116.  
  12117.           Page Frame               A page frame base address is the
  12118.             Base Address           location (in segment format) of the
  12119.                                    first byte of the page frame.
  12120.  
  12121.           Physical Page            A physical page is the range of memory
  12122.                                    addresses occupied by a single 16K-byte
  12123.                                    page.
  12124.  
  12125.           Raw Page                 The smallest unit of mappable memory
  12126.                                    that an expanded memory board can
  12127.                                    supply.
  12128.  
  12129.           Resident Application     A resident application program is loaded
  12130.             Program                by DOS, executes, and remains resident
  12131.                                    in the system after it returns control
  12132.                                    to DOS.  This type of program occupies
  12133.                                    memory and is usually invoked by the
  12134.                                    operating system, an application
  12135.                                    program, or the hardware.  Some example
  12136.                                    of resident application programs are RAM
  12137.                                    disks, print spoolers, and "pop-up"
  12138.                                    desktop programs.
  12139.  
  12140.           Status code              A code that an EMM function returns
  12141.                                    which indicates something about the
  12142.                                    result of running the function.  Some
  12143.                                    status codes indicate whether the
  12144.                                    function worked correctly and others may
  12145.                                    tell you something about the expanded
  12146.                                    memory hardware or software.
  12147.  
  12148.  
  12149.  
  12150.  
  12151.  
  12152.  
  12153.  
  12154.  
  12155.           Glossary                                                      201
  12156.  
  12157.  
  12158.  
  12159.  
  12160.  
  12161.           Transient Application    A transient application program is
  12162.             Program                loaded by DOS, executes, and doesn't
  12163.                                    remain in the system after it returns
  12164.                                    control to DOS.  After a transient
  12165.                                    application program returns control to
  12166.                                    DOS, the memory it used is available for
  12167.                                    other programs.
  12168.  
  12169.           Unmap                    To make a logical page inaccessible for
  12170.                                    reading or writing.
  12171.  
  12172.  
  12173.  
  12174.  
  12175.  
  12176.  
  12177.  
  12178.  
  12179.  
  12180.  
  12181.  
  12182.  
  12183.  
  12184.  
  12185.  
  12186.  
  12187.  
  12188.  
  12189.  
  12190.  
  12191.  
  12192.  
  12193.  
  12194.  
  12195.  
  12196.  
  12197.  
  12198.  
  12199.  
  12200.  
  12201.  
  12202.  
  12203.  
  12204.  
  12205.  
  12206.  
  12207.  
  12208.  
  12209.  
  12210.  
  12211.  
  12212.  
  12213.  
  12214.           Glossary                                                      202
  12215.  
  12216.  
  12217.  
  12218.  
  12219.  
  12220.           INDEX
  12221.  
  12222.  
  12223.  
  12224.                Allocate Alternate Map Register Set  29, 152
  12225.                Allocate DMA Register Set  29, 157, 179
  12226.                Allocate Pages  5, 14, 19, 23, 27, 35, 36, 40, 42, 138,
  12227.                    194, 196
  12228.                Allocate Raw Pages  10, 29, 138, 179, 194
  12229.                Alter Page Map & Call  7, 10, 28, 106, 111, 178
  12230.                Alter Page Map & Jump  7, 10, 28, 102, 178
  12231.                Alternate Map  10, 29, 141, 143, 144, 146-148, 150, 152,
  12232.                    153, 154-157, 159, 162, 164, 168, 171, 179, 185,
  12233.                    197, 198, 199
  12234.                Alternate Map Register Set  10, 29, 141, 143, 144, 146,
  12235.                    147, 148, 150, 152-157, 159, 162, 164, 179, 185,
  12236.                    197, 198
  12237.                Alternate Mapping and Unmapping Methods  74
  12238.                Alternate Register  133, 155, 162, 166
  12239.                Data Aliasing  12
  12240.                Deallocate Alternate Map Register Set  29, 155
  12241.                Deallocate DMA Register Set  29, 164, 179
  12242.                Deallocate Pages  5, 14, 19, 24, 27, 36, 42, 81, 196
  12243.                Design Considerations  84, 141
  12244.                Device Driver  1, 15, 20, 36, 46, 48, 187, 189, 190,
  12245.                    192, 200
  12246.                Disable DMA on Alternate Map Register Set  162
  12247.                Disable OS/E Function Set  29, 168, 169, 171, 174
  12248.                DMA  29, 132-134, 141, 142, 157-165, 179, 185
  12249.                DMA Channels  133, 160, 162, 163, 185
  12250.                DMA Register  29, 133, 134, 141, 142, 157-160, 162-165,
  12251.                    179, 185
  12252.                DOS  1, 12, 14, 15, 19, 20, 23, 24, 42, 46, 81, 187-193,
  12253.                    195-202
  12254.                Enable DMA on Alternate Map Register Set  159
  12255.                Enable OS/E Function Set  29, 168, 169
  12256.                Enable/Disable OS/E Function Set  168, 169, 171, 174
  12257.                Exchange Memory Region  7, 10, 28, 113, 119, 120, 178
  12258.                Expanded Memory Support of DMA  141
  12259.                Expanded Memory Support of DMA Register Sets  141
  12260.                Extended Memory  84
  12261.                Function 1  30
  12262.                Function 10  50
  12263.                Function 11  51
  12264.                Function 12  52
  12265.                Function 13  54
  12266.                Function 14  7, 56
  12267.                Function 15  13, 46, 48, 58, 60, 62, 64, 66, 69, 133,
  12268.                    144, 147, 199
  12269.                Function 16  13, 66, 69, 71
  12270.                Function 17  6, 73, 75, 78
  12271.                Function 18  6, 36, 81, 195
  12272.  
  12273.           Index                                                         203
  12274.  
  12275.  
  12276.  
  12277.  
  12278.  
  12279.                Function 19  7, 84, 85, 87, 89
  12280.                Function 2  4, 31
  12281.                Function 20  7, 91, 93
  12282.                Function 21  7, 35, 95, 98, 100
  12283.                Function 22  102
  12284.                Function 23  106, 111
  12285.                Function 24  7, 113, 119
  12286.                Function 25  6, 8, 39, 67, 78, 126, 130
  12287.                Function 26  132, 136, 168, 171, 194
  12288.                Function 27  39, 73, 82, 138, 139, 194
  12289.                Function 28  134, 141, 143, 146, 150, 152, 153, 155,
  12290.                    157, 159, 162, 164, 168, 171, 197
  12291.                Function 29  166
  12292.                Function 3  4, 33, 136
  12293.                Function 30  132, 141, 143, 146, 150, 152, 155, 157,
  12294.                    159, 162, 164, 168, 171, 174
  12295.                Function 4  4, 35, 36, 39, 40, 42, 73, 82, 138, 139,
  12296.                    194, 196
  12297.                Function 5  4, 39, 74
  12298.                Function 6  4, 36, 42, 81, 196
  12299.                Function 7  5, 44
  12300.                Function 8  39, 43, 46, 48
  12301.                Function 9  39, 43, 46, 48
  12302.                Get & Set Page Map  28, 62
  12303.                Get All Handle Pages  9, 27, 56
  12304.                Get Alternate Map Register Set  29, 143, 179
  12305.                Get Alternate Map Save Array Size  29, 150, 179
  12306.                Get Attribute Capability  7, 89
  12307.                Get Expanded Memory Hardware Information  10, 132, 136,
  12308.                    168, 171
  12309.                Get Handle Attribute  28, 85
  12310.                Get Handle Count  9, 27, 52
  12311.                Get Handle Directory  10, 28, 95, 98, 100
  12312.                Get Handle Name  28, 91
  12313.                Get Handle Pages  7, 9, 27, 54
  12314.                Get Hardware Configuration Array  132
  12315.                Get Interrupt Vector  15, 20, 23, 187, 192, 193
  12316.                Get Mappable Physical Address Array  6, 8, 10, 28, 39,
  12317.                    78, 126, 130
  12318.                Get Mappable Physical Address Array Entries  8, 130
  12319.                Get Page Frame Address  5, 27, 31
  12320.                Get Page Map  28, 58, 111, 144, 147, 199
  12321.                Get Page Map Stack Space Size  28, 111
  12322.                Get Partial Page Map  28, 66, 71
  12323.                Get Size of Page Map Save Array  28, 58, 60, 64, 133
  12324.                Get Size of Partial Page Map Save Array  67, 69, 71
  12325.                Get Status  5, 27, 30
  12326.                Get Total Handles  28, 100
  12327.                Get Unallocated Page Count  5, 27, 33, 136
  12328.                Get Unallocated Raw Page Count  29, 136, 178
  12329.                Get Version  5, 27, 44
  12330.                Get/Set Handle Attribute  9, 84, 85, 87, 89
  12331.  
  12332.           Index                                                         204
  12333.  
  12334.  
  12335.  
  12336.  
  12337.  
  12338.                Get/Set Handle Name  10, 91, 93
  12339.                Get/Set Page Map  9, 13, 58, 60, 62, 64
  12340.                Get/Set Partial Page Map  9, 13, 66, 69, 71
  12341.                Handle Attribute  9, 28, 84-87, 89, 177
  12342.                Handle Name  6, 7, 10, 28, 91, 93, 98, 99, 177, 186
  12343.                Intel  i, ii, 1, 5, 50, 51
  12344.                Interrupt Vector  12, 15, 20, 23, 187, 192, 193
  12345.                LIM  1, 7, 13, 46, 48, 132, 134, 194, 195
  12346.                Logical Page  1, 5, 12, 16, 21, 24, 25, 39-41, 73-76,
  12347.                    78, 79, 81, 103, 104, 108, 109, 113, 115, 116, 118,
  12348.                    119, 121, 122, 124, 138, 182, 184, 195, 200-202
  12349.                Logical Page/Physical Page Method  75
  12350.                Logical Page/Segment Address Method  78
  12351.                Lotus  i, ii, 1, 5, 50, 51
  12352.                Map Register  10, 13, 29, 46, 48, 141, 143, 144, 146,
  12353.                    147, 148, 150, 152-157, 159, 162, 164, 168, 171,
  12354.                    179, 185, 197-199
  12355.                Map/Unmap Handle Pages  39
  12356.                Map/Unmap Multiple Handle Pages  9, 28, 73, 75, 78
  12357.                Mapping and Unmapping Multiple Pages Simultaneously  73
  12358.                Mapping Multiple Pages  6, 73
  12359.                Microsoft  i, ii, 1, 5, 14, 23, 35, 50, 51
  12360.                Move Memory Region  28, 113, 114, 178
  12361.                Move/Exchange Memory Region  7, 10, 113, 119
  12362.                Open Handle  57, 95, 187, 188, 191, 192
  12363.                Operating System  3, 8, 10-12, 35, 36, 52, 56, 100, 132,
  12364.                    133, 135, 136, 138-141, 143-148, 150-152, 154-160,
  12365.                    162-166, 168-172, 174, 175, 179, 186, 194, 195, 196,
  12366.                    197, 201
  12367.                Page Frame  1-6, 14, 17-19, 21, 22, 24, 27, 31, 32, 40,
  12368.                    46, 48, 114, 121, 127, 176, 201
  12369.                Page Map  7, 9, 10, 13, 27, 28, 43, 46, 48, 58, 60, 62,
  12370.                    64, 66-69, 71, 102, 106, 111, 133, 144, 147, 176,
  12371.                    177, 178, 199
  12372.                Page Mapping Register I/O Array  50
  12373.                Page Translation Array  51
  12374.                Physical Page  1, 5, 6, 8, 10, 12, 16, 21, 24, 28, 39,
  12375.                    40, 41, 73-76, 78, 102-105, 107-110, 126-128, 130,
  12376.                    132, 133, 136, 138, 177, 182, 195, 197, 201
  12377.                Prepare Expanded Memory Hardware For Warm Boot  10, 166
  12378.                Raw Handle  138-140, 194, 195
  12379.                Raw Page  29, 136-138, 178, 194
  12380.                Reallocate Pages  9, 28, 36, 81, 196
  12381.                Restore Page Map  9, 13, 27, 43, 46, 48
  12382.                Return Access Key  174
  12383.                Save Page Map  9, 13, 27, 43, 46, 48
  12384.                Search For Named Handle  7, 28, 98
  12385.                Set Alternate Map Register Set  29, 143, 144, 146, 147,
  12386.                    152, 179
  12387.                Set Handle Attribute  9, 28, 84, 85, 87, 89
  12388.                Set Handle Name  7, 10, 28, 91, 93
  12389.                Set Page Map  9, 13, 28, 58, 60, 62, 64, 177
  12390.  
  12391.           Index                                                         205
  12392.  
  12393.  
  12394.  
  12395.  
  12396.  
  12397.                Set Partial Page Map  9, 13, 28, 66, 69, 71
  12398.                System DMA Capabilities  141
  12399.                TSR  12, 13, 196
  12400.                Unmapping Multiple Pages  6, 73
  12401.  
  12402.  
  12403.  
  12404.  
  12405.  
  12406.  
  12407.  
  12408.  
  12409.  
  12410.  
  12411.  
  12412.  
  12413.  
  12414.  
  12415.  
  12416.  
  12417.  
  12418.  
  12419.  
  12420.  
  12421.  
  12422.  
  12423.  
  12424.  
  12425.  
  12426.  
  12427.  
  12428.  
  12429.  
  12430.  
  12431.  
  12432.  
  12433.  
  12434.  
  12435.  
  12436.  
  12437.  
  12438.  
  12439.  
  12440.  
  12441.  
  12442.  
  12443.  
  12444.  
  12445.  
  12446.  
  12447.  
  12448.  
  12449.  
  12450.           Index                                                         206
  12451.  
  12452.